note 73061 added to function.readdir

From: Date: Wed, 07 Feb 2007 19:05:50 +0000
Subject: note 73061 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-123065@lists.php.net to get a copy of this message
This is a simple function, similar to the PHP5's scandir(), but works for PHP4 aswell. It returns an array with files and directories in it, skipping directories and the '..' and '.' if you choose to. <?php function php4_scandir($dir,$listDirectories=false, $skipDots=true) { $dirArray = array(); if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if (($file != "." && $file != "..") || $skipDots == true) { if($listDirectories == false) { if(is_dir($file)) { continue; } } array_push($dirArray,basename($file)); } } closedir($handle); } return $dirArray; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 201.6.139.41 ---- Manual Page -- http://www.php.net/manual/en/function.readdir.php Edit -- https://master.php.net/note/edit/73061 Del: integrated -- https://master.php.net/note/delete/73061/integrated Del: useless -- https://master.php.net/note/delete/73061/useless Del: bad code -- https://master.php.net/note/delete/73061/bad+code Del: spam -- https://master.php.net/note/delete/73061/spam Del: non-english -- https://master.php.net/note/delete/73061/non-english Del: in docs -- https://master.php.net/note/delete/73061/in+docs Del: other reasons-- https://master.php.net/note/delete/73061 Reject -- https://master.php.net/note/reject/73061 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123065) next »