Roeland Roeland - 1 month ago 5
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!


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

array_pop(explode('/', $string));