note 86029 added to function.readdir
| From: | Anonymous at osu1 dot php dot net | Date: | Tue, 30 Sep 2008 08:09:52 +0000 |
| Subject: | note 86029 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144895@lists.php.net to get a copy of this message | ||
@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.
----
Server IP: 217.13.201.10
Probable Submitter: 194.180.18.1
----
Manual Page -- http://www.php.net/manual/en/function.readdir.php
Edit -- https://master.php.net/note/edit/86029
Del: integrated -- https://master.php.net/note/delete/86029/integrated
Del: useless -- https://master.php.net/note/delete/86029/useless
Del: bad code -- https://master.php.net/note/delete/86029/bad+code
Del: spam -- https://master.php.net/note/delete/86029/spam
Del: non-english -- https://master.php.net/note/delete/86029/non-english
Del: in docs -- https://master.php.net/note/delete/86029/in+docs
Del: other reasons-- https://master.php.net/note/delete/86029
Reject -- https://master.php.net/note/reject/86029
Search -- https://master.php.net/manage/user-notes.php