For example, if there is a url like www.website.com/hello/richard
, would it be possible to echo hello and 100 separately onto my page.
eg:
hello how are you today richard
For example, if there is a url like www.website.com/hello/richard
, would it be possible to echo hello and 100 separately onto my page.
eg:
hello how are you today richard
Yes it would be. Try this:
$myURL = $_SERVER['REQUEST_URI'];
$myTokens = explode('/', $myURL);
echo $myTokens[1] . "blah" . $myTokens[2];
This code gets the current URL into the myURL variable, then it calls a function called explode which turns it into an array based on the position of the '\' character. Then it echos out certain elements of that array. If you play around with output using echo you will soon see for yourself what is going on.