Question

<?php
$ReturnValue = array();

if ($handle = opendir('img/albums/brinquedos/')){
    while (false !== ($entry = readdir($handle))){
        if ($entry != "." && $entry != ".."){   
            $ReturnValue[] .= $entry;
        }
    }
    closedir($handle);
}

foreach($ReturnValue as $row){
    echo '<div class="galleryItem"><img src=img/albums/brinquedos/'.$row.'><h2 class="marketing menuItem">Hey</h2></div>';
}?>

So this is a script for fetching all the images in a folder and throwing them to a page, problem is:

It gets all the images and throws them at once so I'm not sure how to add an image description to each image...

would array_combine() do the trick? Or not, because an associative array would have its index replaced with the key ? as:

$randomArray = array("a"=>"b","c"=>"d")

$randomArray[a] ?

Despite being a possibly stupid question it is still interesting.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top