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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.