I'm working from a Wordpress website, and I need to be able to create a template for a real quick-and-simple custom order page.
The plan is to create pages so that the URL of said page will be http://www.website.com/order-1234
And then, the template being used for that page will have PHP in it that will try and grab the "1234" portion of the URL, and use it as a variable.
$url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$order_id = intval(substr($url, strrpos($url, '/order-') + 4));
echo $order_id;
But the above code is returning a zero "0"
+7-$order_id = intval(substr($url, strrpos($url, '/order-') + 7));see phpFiddle - phpfiddle.org/main/code/tse-vbrsubstr($url,-4);but you still need to do some checkingorder-123ororder-12345