Get Filename from full file path

Description PHP

Gets a filename from a full path with it's parent directory, the right part of string before the '/'

The Code Download

  1. <?php
  2. function GetFilename($file) {
  3.     $filename = substr($file, strrpos($file,'/')+1,strlen($file)-strrpos($file,'/'));
  4.     return $filename;
  5. }
  6. ?>


Added by JC on 11th November 2007


There are no comments about this snippet.

Post Comment Github Markdown Supported

You must be logged in to post a comment.

Login here to post a comment