I currently have the string: "/en/sports/football/"
How do I substr this string to achieve:
"/sports/football/"
Man开发者_开发技巧y thanks for any pointers.
Well, lets take a look: http://php.net/manual/en/function.substr.php
The method signature looks something like this:
string substr ( string $string , int $start [, int $length ] )
If length is omitted, the substring starting from start until the end of the string will be returned.
So I guess we could do something like this to get characters 3 and onward.
substr("/en/sports/football/", 3);
explode()
on '/', discard the directory you don't want, then implode()
on '/'
精彩评论