Recent Posts
- Tunegrove Blog Launched!
- Note to Self: Avoid Bulk SMS
- Memory Leak with s3 Fuse s3fs Over https
- Back to School
- My new HP TouchPad – Better, Faster, Stronger, Overclocked
- New Site Design 2011
- Disable Verizon V-Cast popup / autostart on Android HTC Incredible
- Mock Draft 2010 iPhone, iPad and iPod touch now Available!
- What is SEO? An introduction to Search Engine Optimization and search result rank
- Detect File Types For Files With No Extension
- Seperate the directory and file portions of a string path in PHP
- Migrating wordpress to a new server
- A customized web-based wysiwyg that can clean a paste from MS Word
- Google Talk Crashes When I Select Show current music track Status, using Winamp
- How to Fix Problmes with CSS Float Elements in IE, FireFox, Safari, etc
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.