note 45379 added to function.is-file

From: Date: Fri, 03 Sep 2004 22:04:17 +0000
Subject: note 45379 added to function.is-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-76002@lists.php.net to get a copy of this message
regarding rlh at d8acom dot com method, It is incorrect. Well, it works but you are not guaranteed the file extension using that method. for example : filename.inc.php your method will tell you the ext is "inc", but it is in fact "php" heres a way that will work properly. <?php $dh = opendir($dir); while (false !== ($document = readdir($dh))) { $pos = strrpos($document, '.'); if (false !== $pos && strlen($document) > $pos + 1) { $ext = substr($document, $pos + 1); } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.is-file.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45379 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45379&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45379&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#76002) next »