lang="en-US"> PHP Tutorial: Get Filename From Domain Path –  Design1online.com, LLC

PHP Tutorial: Get Filename From Domain Path

<?php
/****
* Purpose: get the filename from the path
* Precondition: path i.e. http://domain.com/contacts.php
* Postcondition: returns the filename i.e. contacts.php
****/
function fileName($path)
{
     return substr($path, strrpos($path, '/')+1, strlen($path));
}
?>

Programming Challenge Main Page or Continue to Day 3

You may also like...

2 Responses

  1. August 5, 2009

    […] Filename From Domain Path […]

  2. August 6, 2009

    […] Programming Challenge Main Page or Continue to Day 2 […]

Leave a Reply