I want to add item to my array using loop. But i can't make it right.
I tried this code, and it can't gave me the Format/Output i want.
$img_arr[]= "";
foreach ($images as $image) {
$img_arr['src'][] .= $image['src'];
}
i want this kind of output.
array (
'src' => 'https://example.com/wp-content/uploads/2019/07/3.jpg',
),
array (
'src' => 'https://example.com/wp-content/uploads/2019/07/2-1.jpg',
),
array (
'src' => 'https://example.com/wp-content/uploads/2019/07/3.jpg',
),
array (
'src' => 'https://example.com/wp-content/uploads/2019/07/1-1.jpg',
),
array (
'src' => 'https://example.com/wp-content/uploads/2019/07/4-1.jpg',
)