SplFileInfo::getExtension
(PHP 5 >= 5.3.6)
SplFileInfo::getExtension — Gets the file extension
Descripción
public string SplFileInfo::getExtension
( void
)
Retrieves the file extension.
Parámetros
Esta función no tiene parámetros.
Valores devueltos
Returns a string containing the file extension, or an empty string if the file has no extension.
Ejemplos
Example #1 SplFileInfo::getExtension() example
<?php
$info = new SplFileInfo('foo.txt');
var_dump($info->getExtension());
$info = new SplFileInfo('photo.jpg');
var_dump($info->getExtension());
$info = new SplFileInfo('something.tar.gz');
var_dump($info->getExtension());
?>
El resultado del ejemplo sería:
string(3) "txt" string(3) "jpg" string(2) "gz"
Ver también
- SplFileInfo::getFilename() - Gets the filename
- SplFileInfo::getBasename() - Gets the base name of the file
- pathinfo() - Devuelve información acerca de una ruta de archivo
There are no user contributed notes for this page.
