PHP Help
PHP Help
Out of context: Reply #10
- Started
- Last post
- 10 Responses
- rabbit0
you need to create an empty array, push each item into the array then sort it and output it:
<?php
function getAllImagesInDirectory($path) {
if ($handle = opendir($path)) {
$images = array();
while (false !== ($file = readdir($handle))) {
if($file !== "." && $file !== "..") {
array_push($images, $path.'\\'.$file);
}}
closedir($handle);asort($images);
foreach ($images as $key => $val) {
echo "$key = $val\n";
}}
}
?>