Seperate the directory and file portions of a string path in PHP

I was about to build my own function to separate the directory and file name portions of a string that contained both in php, when I decided to do a quick search to see if one already existed.  I was happy to find that php does this automatically with 2 functions.

basename($str) will return the filename portion of a given $str.

dirname($str) will return the directory portion of a given $str.