I have an array that includes images and orders;
foreach ($images as $image){ $results => [ 'url' => $image["url"] 'order' => $image["order"] ] }
This only gets the first image and order. I need to get all the images and orders and execute excute each entry like ;
Array ( [attribute] => [ [url] => "foo" [order] => "boo" ] [attribute] => [ [url] => "foo" [order] => "boo" ] ) //... etc 'images' => [ $results; // need to use the $results array in another array like this ]
thanks for help.
Just try this:
$results = []; foreach ($images as $image){ $results['attribute'][] = [ 'url' => $image["url"], 'order' => $image["order"] ]; } print_r($results);
1.4m articles
1.4m replys
5 comments
56.9k users