php - loop logic can't effect every element -


thanks in advance helping, , looking.

i have bunch of images paths , metadata need process in web directory: e.g. 'path/to/files/u_1.jpg'

$list=array_values($list); foreach ($list &$value)    list($width, $height) = getimagesize($dir.$udir.$value);    $value = $predir.$udir.$value.$wid.$width.$hgt.$height.$lft.$end; 

i used scandir elements $list array correctly.
rest of variables, creating img tags in html page.

however, last element done correctly, rest not come out of loop:

array ( [0] => u_1.jpg ... [16] => u_8.jpg [17] => img src="/images/photo/up/u_9.jpg" style="display: none; width: 1526px; height: 1080px; left: 0px; top: px; "> ) 

but metadata correctly found (image height , width image).

what need every line last. have searched think may fundamental logic issue. there way pass info holding array, or along lines?

without {} foreach consider on next line it. last element values set. put {}s foreach know process. try -

foreach ($list &$value) {    list($width, $height) = getimagesize($dir.$udir.$value);    $value = $predir.$udir.$value.$wid.$width.$hgt.$height.$lft.$end; } 

Comments