note 74055 deleted from function.is-dir by cece

From: Date: Thu, 22 Mar 2007 15:12:37 +0000
Subject: note 74055 deleted from function.is-dir by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-124719@lists.php.net to get a copy of this message
Note Submitter: diekick_89 at hotmail dot com Reason: bad code ---- here is a good example for list of files and folders:- <?php $d = dir("./"); echo "Handle: " . $d->handle . "\n"; echo "Path: " . $d->path . "\n"; while (false !== ($entry = $d->read())) { if(is_dir($entry)){ $a[] = $entry; }else{ $b[] = $entry; } } $d->close(); sort($a); sort($b); for($i=0;$i<count($a);$i++){ echo "<br> \n" . '<a href="'. basename($a[$i]) . '">' . $a[$i] . '</a>'; } for($i=0;$i<count($b);$i++){ echo "<br> \n" . '<a href="'. basename($b[$i]) . '">' . $b[$i] . '</a>'; } ?>

« previous php.notes (#124719) next »