I diedump this array and there is a number inside data array
^ array:1 [▼
"data" => array:15 [▼
0 => array:15 [▼
"product_name" => "MOBILELEGEND - 86 Diamond"
"category" => "Games"
"brand" => "MOBILE LEGEND"
"type" => "Umum"
"seller_name" => "PT***"
"price" => 19800
"buyer_sku_code" => "ML86"
"buyer_product_status" => true
"seller_product_status" => true
"unlimited_stock" => true
"stock" => 0
"multi" => true
"start_cut_off" => "23:30"
"end_cut_off" => "0:20"
"desc" => "no pelanggan = gabungan antara user_id dan zone_id"
]
1 => array:15 [▶]
2 => array:15 [▶]
]
]
How can I foreach the value inside the number? the number I mean is 0,1,2
CodePudding user response:
You need to use nested foreach to loop through the multidimensional array you have.
let your array be called $arr
for example
// $arr = [ 'data' => [ ['name' => 'lorem'], ... ]];
foreach ($arr['data'] as $item) {
foreach ($item as $key => $value) {
// Do whatever you need here...
}
}