jinni
jinni

Reputation: 1

php array. cant get the output i desire. help me

i have this code

$dir = "img/ori/";  
$dir_thumbs = "img/thumbs/";

$images = array();  
$d = dir($dir);  
while($name = $d->read()){  
    $thumb = "thumb_".$name;  
    $images[] = array('name' => $name,'thumb_url' => $dir_thumbs.$thumb);  
}  
$d->close();  
$o = array('images'=>$images);  

i want to output $name and $thumb_url of all the images. how to do it.? help me

Upvotes: -1

Views: 114

Answers (2)

scragz
scragz

Reputation: 6690

<?php
foreach ($images as $image) {
    echo "{$image['name']} {$image['thumb_url']}";
}
?>

Upvotes: 3

Jacob Relkin
Jacob Relkin

Reputation: 163228

Use print_r or var_dump for this:

print_r($o);
//or
var_dump($o);

Upvotes: 2

Related Questions