1. Retrieving a Path’s Filename: $path = '/home/www/data/users.txt'; $file_nm = basename($path); // "users.txt" $file_nm_1 = basename($path, ".txt"); // "users", no extension. 2. Retrieving a Path’s Directory: $path = '/home/www/data/users.txt'; $dir_nm = dirname($path) // "/home/www/data" 3. Learning More about a Path: $pathinfo = pathinfo('/home/www/htdocs/book/chapter10/index.html'); echo $pathinfo['dirname']; // "/home/www/htdocs/book/chapter10" echo $pathinfo['basename']; // "index.html" echo $pathinfo['extension']; // "html" […]
Read more »