Roeland Roeland - 1 year ago 78
PHP Question

Grab remaining text after last "/" in a php string

So, lets say I have a

thats holds the value "main/physician/physician_view".

I want to grab just "physician_view". I want it to also work if the passed string was "main/physician_view" or "site/main/physician/physician_view".

Hopefully my question makes sense. Any help would be appreciated!

Answer Source

There are many ways to do this. I would probably use:

array_pop(explode('/', $string));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download