Home Tutorial Php Phpfiles PHP basename() function, PHP basename function example

 
 

PHP basename() function, PHP basename function example
Posted on: September 16, 2009 at 12:00 AM
PHP base name function example code. Learn how to use basename() function in your PHP program.

In this section we will learn about the basename() function of php

This example of basename()  function in PHP

Description about PHP basename():

syntax for PHP basename()Function

string basename ( string $path [, string $suffix ] )

On giving the $path value with the file name with path it will return base file name .

if suffix is given then suffix will not come in result

Code:

<?php

$base1=basename("c:\rose1\ss.java",".java");

echo $base1;

?>

Program output:

ss

Code:

<?php

$base1=basename("c:\rose1\ss.java","");

echo $base1;

?>

Program output:

ss.java

 

Related Tags for PHP basename() function, PHP basename function 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.