note 106229 added to function.is-file

From: Date: Wed, 19 Oct 2011 22:19:51 +0000
Subject: note 106229 added to function.is-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-184010@lists.php.net to get a copy of this message
Another approach on how to get all php files inside a directory <?php $allDirs = array(array('/absolute/path/of/folder')); $dirLevel = 0; $searchFactor = 0; $searchPath = ''; $keepLooking = TRUE; while ($keepLooking) { $tmp = array(); foreach ($allDirs[$dirLevel] as $searchPath) { foreach (scandir($searchPath) as $filename) { $host = $searchPath.'/'.$filename; if (is_dir($host) && substr($filename, 0, 1) != '.') { $searchFactor++; array_push($tmp, $host); } elseif (is_file($host)) { $forExt = explode('.', $host); if ($forExt[count($forExt) - 1] == 'php' && substr($filename, 0, 1) != '.') echo $host.'<br/>'; } } } if ($searchFactor > 0) { $dirLevel++; array_push($allDirs, $tmp); $searchFactor = 0; } else $keepLooking = FALSE; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 190.222.188.132 ---- Manual Page -- http://www.php.net/manual/en/function.is-file.php Edit -- https://master.php.net/note/edit/106229 Del: integrated -- https://master.php.net/note/delete/106229/integrated Del: useless -- https://master.php.net/note/delete/106229/useless Del: bad code -- https://master.php.net/note/delete/106229/bad+code Del: spam -- https://master.php.net/note/delete/106229/spam Del: non-english -- https://master.php.net/note/delete/106229/non-english Del: in docs -- https://master.php.net/note/delete/106229/in+docs Del: other reasons-- https://master.php.net/note/delete/106229 Reject -- https://master.php.net/note/reject/106229 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184010) next »