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

 
 

Share on Google+Share on Google+
PHP basename() function, PHP basename function example
Posted on: September 16, 2009 at 12:00 AM
Advertisement
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

 

Advertisement

Related Tags for PHP basename() function, PHP basename function example:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: September 16, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com