The basename() function returns the filename from a path.
basename(path,suffix)
<?php $path = "/testweb/home.php";
//Show filename with file extension echo basename($path) ."<br/>";
//Show filename without file extension echo basename($path,".php"); ?>
The output of the code above will be:
home.php home
Jump to: Top of Page or HOME or Printer friendly page
W3Schools provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright 1999-2008 by Refsnes Data. All Rights Reserved.