<?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());
?>
The above example will output:
string(3) "txt"
string(3) "jpg"
string(2) "gz"
0 comments:
Post a Comment