How can I use php to get the sting bewteen the 7th and 8th /
http://uk.soccerway.com/matches/2015/01/01/england/premier-league/stoke-city-fc/manchester-united-fc/1703889/?ICID=HP_MS_01_01
so the above would grab england
How can I use php to get the sting bewteen the 7th and 8th /
http://uk.soccerway.com/matches/2015/01/01/england/premier-league/stoke-city-fc/manchester-united-fc/1703889/?ICID=HP_MS_01_01
so the above would grab england
Something like:
$url = 'http://uk.soccerway.com/matches/2015/01/01/england/premier-league/stoke-city-fc/manchester-united-fc/1703889/?ICID=HP_MS_01_01';
$tokens = explode('/', $url);
echo $tokens[7]; // 'england'
PHP docs for explode()
php function explode does the exact thing learn more: http://php.net/manual/en/function.explode.php
Try this:
$n = 7; $m = 8;
$str = "http://uk.soccerway.com/matches/2015/01/01/england/premier-league/stoke-city-fc/manchester-united-fc/1703889/?ICID=HP_MS_01_01";
$a = explode('/', $str);
echo $a[$n];
Like this, you can get it for any random value of n and m.
Hope this helps.
Peace! xD