I have a URL that is in the following structure: http://somewebsite.com/directory1/directory2/directory3...
I'm trying to get the last directory name from this url, but the depth of the url isn't always constant so i don't think i can use a simple substr or preg_match call - is there a function to get the last instance of a regular expression match from a string?