开发者

Remove all before certain delimiter starting at end of string PHP

Hey, I need help isolating part of a url in PHP.

开发者_Go百科

say I have

http://www.test.com/something/something/important/

How could I isolate the "important"

Thanks!


Use the basename() function for that.

echo basename('http://www.test.com/something/something/important/');

Result:

important


<?php
$url ='http://www.test.com/something/something/important/';
echo basename($url);
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜