foreach ($array as &$value) {
$q3 = "SELECT * FROM wp_posts WHERE post_name = '$value'";
$r3 = $wpdb->get_results($q3);
$Idd = $r3[0]->ID;
$img = wp_get_attachment_url( get_post_thumbnail_id($Idd, 'thumbnail') );
//echo $value;
//echo $Idd;
//echo $img;
$list .= '<li><img src="'.$img.'"/><br>'.$value.'</li>';
}
Using the above, if I echo $value my array is printed. if I echo $Idd the result instead of several ID's is just a singular and the same goes for $img
How can I run the above to work and print out the $img's and $Idd
Thanks
&is a reference operator - php.net/manual/en/language.oop5.references.php. As such,$valueis a direct reference to the entry in$array, not a copy of it.