irwan

extract filename from a full path string

Nov 15th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.17 KB | None | 0 0
  1. <?php
  2. $path = "/home/httpd/html/index.php";
  3. $file = basename($path);        // $file is set to "index.php"
  4. $file = basename($path, ".php"); // $file is set to "index"
  5. ?>
  6.  
Advertisement
Add Comment
Please, Sign In to add comment