note 71758 added to function.scandir

From: Date: Thu, 14 Dec 2006 15:38:24 +0000
Subject: note 71758 added to function.scandir
Groups: php.notes 
Request: Send a blank email to php-notes+get-120608@lists.php.net to get a copy of this message
A nice function to read a dir, with unlimited subdirs and files, it will create an array with files and dirs (tree structure). <?php function dirlist($dir) { foreach(scandir($dir) as $entry) if($entry != '.' && $entry != '..') { $entry = $dir.'/'.$entry; if(is_dir($entry)) { $path = pathinfo($entry); $listarray[$path['basename']] = dirlist($entry); } else { $path = pathinfo($entry); $listarray[] = $path['basename']; } } return($listarray); } ?> ---- Server IP: 194.109.193.94 Probable Submitter: 217.194.107.215 ---- Manual Page -- http://www.php.net/manual/en/function.scandir.php Edit -- https://master.php.net/note/edit/71758 Del: integrated -- https://master.php.net/note/delete/71758/integrated Del: useless -- https://master.php.net/note/delete/71758/useless Del: bad code -- https://master.php.net/note/delete/71758/bad+code Del: spam -- https://master.php.net/note/delete/71758/spam Del: non-english -- https://master.php.net/note/delete/71758/non-english Del: in docs -- https://master.php.net/note/delete/71758/in+docs Del: other reasons-- https://master.php.net/note/delete/71758 Reject -- https://master.php.net/note/reject/71758 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120608) next »