note 86029 deleted from function.readdir by danbrown
| From: | danbrown@php.net | Date: | Thu, 25 Feb 2010 20:33:25 +0000 |
| Subject: | note 86029 deleted from function.readdir by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-166373@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
@mesyash_one at wp dot pl
Don´t use
<?php
$fileChunks = explode(".", $file);
$ext= $fileChunks[1];
?>
It will create a notice if there is a file without extension. And if theres a file with 2 dots the
result will be wrong.
Better use
<?php
$fileChunks = array_reverse(explode(".", $file));
$ext= $fileChunks[0];
?>
and check for files without extension.