★ wanayoo — archive 1999 http://www.php.net/manual/function.basename.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Filesystem
Quick Reference
German version of this pageJapanese version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
Filesystem
* basename
* chgrp
* chmod
* chown
* clearstatcache
* copy
* delete
* dirname
* diskfreespace
* fclose
* feof
* fgetc
* fgetcsv
* fgets
* fgetss
* file
* file_exists
* fileatime
* filectime
* filegroup
* fileinode
* filemtime
* fileowner
* fileperms
* filesize
* filetype
* flock
* fopen
* fpassthru
* fputs
* fread
* fscanf
* fseek
* fstat
* ftell
* ftruncate
* fwrite
* set_file_buffer
* is_dir
* is_executable
* is_file
* is_link
* is_readable
* is_writeable
* link
* linkinfo
* mkdir
* pclose
* popen
* readfile
* readlink
* rename
* rewind
* rmdir
* stat
* lstat
* realpath
* symlink
* tempnam
* touch
* umask
* unlink
Manual: basename
View the source code for this pageSearch the site



Previous page
 Filesystem
 Updated
Sat, 12 Aug 2000
chgrp 
Next page


basename

(PHP3 , PHP4 )

basename --  Return filename component of path

Description

string basename (string path)

Given a string containing a path to a file, this function will return the base name of the file.

On Windows, both slash (/) and backslash (\) are used as path separator character. In other environments, it is the forward slash (/).

Example 1. basename() example


$path = "/home/httpd/html/index.php3";
$file = basename($path); // $file is set to "index.php3"
      

See also: dirname()


User Contributed Notes: basename


chopin@csone.kaist.ac.kr
10-Sep-1999 02:48
tailing directory char '/' is ignored in dirname() and basename()
<PRE>
dirname("http://host.net/dir/dir2/") = "http://host.net/dir"
basename("http://host.net/dir/dir2/") = "dir2"
</PRE>



 About Notes


Previous page
 Filesystem
 Updated
Sat, 12 Aug 2000
chgrp 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.