If you have a url like this: rapidshare.com/#!download|value1|values|value3
and you know the numbers how can you extract the value 1 and the value 3
Is there a way to extract the values between the 2nd and 3rd | and 3rd and 4th |
Thanks!
If you have a url like this: rapidshare.com/#!download|value1|values|value3
and you know the numbers how can you extract the value 1 and the value 3
Is there a way to extract the values between the 2nd and 3rd | and 3rd and 4th |
Thanks!
$array = explode('|', $url);
And use $array[$index];
Al of the above are 1 way of doing this, but if your script is always extracting data after your script name. as in: somepage.com/download.php?var1='val1'&var2='val2' the only relevant part for you is var1='val1'&var2='val2'
Luckily, PHP has a superglobal that can help. $_SERVER['QUERY_STRING'] . This way you can get an array of values, much cleaner and not have to worry that your explode seperator was being used on any other part of the URL.
$url = $_SERVER['REQUEST_URI'];
$values = explode("|", $url);