downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SplFileInfo::getCTime> <SplFileInfo::getATime
[edit] Last updated: Fri, 25 May 2012

view this page in

SplFileInfo::getBasename

(PHP 5 >= 5.2.2)

SplFileInfo::getBasenameLe le nom du fichier

Description

public string SplFileInfo::getBasename ([ string $suffix ] )

Cette méthode retourne le nom du fichier, dossier ou lien sans le chemin.

Liste de paramètres

suffix

Un suffixe optionnel à omettre dans le nom de fichier retourné.

Valeurs de retour

Retourne le nom du fichier, sans les informations de chemin.

Exemples

Exemple #1 Exemple avec SplFileInfo::getBasename()

<?php
$info 
= new SplFileInfo('file.txt');
var_dump($info->getBasename());

$info = new SplFileInfo('/path/to/file.txt');
var_dump($info->getBasename());

$info = new SplFileInfo('/path/to/file.txt');
var_dump($info->getBasename('.txt'));
?>

L'exemple ci-dessus va afficher quelque chose de similaire à :

string(8) "file.txt"
string(8) "file.txt"
string(4) "file" 

Voir aussi



add a note add a note User Contributed Notes SplFileInfo::getBasename
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites