The problem I have is that value gets overwritten in second foreach loop. I need to set the key to image thumbnail link and set value to an image path.
$img_thumbs = array('folder/thumb1.jpg','folder/thumb2.jpg','folder/thumb3.jpg');
$img_links = array('folder/image1.jpg','folder/image2.jpg','folder/image3.jpg');
$imgs = array();
foreach($img_links as $img_val)
{
foreach($img_thumbs as $thum_val)
{
$imgs[$thum_val] = $img_val
}
}
print_r($imgs);
OUTPUT (notice how image value repeats the last value):
Array (
["folder/thumb1.jpg"] => ["folder/image3.jpg"],
["folder/thumb2.jpg"] => ["folder/image3.jpg"],
["folder/thumb3.jpg"] => ["folder/image3.jpg"]
)
WHAT I NEED:
Array (
["folder/thumb1.jpg"] => ["folder/image1.jpg"],
["folder/thumb2.jpg"] => ["folder/image2.jpg"],
["folder/thumb3.jpg"] => ["folder/image3.jpg"]
)
Thanks in advance