Posted by AlexVN on 10/29/08 11:50
J Huntley Palmer wrote:
> How may I capture the last /.../ in a url?
>
> eg.. www.foo.com/foo/bar/baz/index.php?param=1
>
> I want to capture 'baz'.
>
> Thanks
Just my $0.02:
$t = parse_url('www.foo.com/foo/bar/baz/index.php?param=1');
$t = pathinfo($t['path']);
$t = explode('/', $t['dirname']);
$t = array_pop($t);
var_dump('baz' == $t);
Sincerely,
Alexander
http://www.alexatnet.com/
Navigation:
[Reply to this message]
|