Home Tutorial Php Examples basename() example

 
 

basename() example
Posted on: July 30, 2009 at 12:00 AM
Here you will learn the example of basename().

basename()

The function basename () is used for printing the basename of the file, e.g.

<?php
$name = "c:/wamp/www/dest.txt";
echo basename($name) ."<br/>";
echo basename($name,".txt");
?>

The output of this example will print both the base name of the file with extension and basename without extension.

Related Tags for basename() example:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.