Reputation: 476
I have an array with products (each product has more arrays)
I want to get the values ["0_1"] or ["0_2"]? If it starts with 0 it should send that product to the end of the array
array(14) {
["0_1"]=> array(27) {
["files"]=> array(0) { }
["images"]=> array(0) { }
["form_addtocart"]=> string(0) ""
["has_addtocart"]=> bool(false)
["product_flypage"]=> string(137) "index.php?page=shop.product_details&flypage=flypage.tpl&product_id=3299&category_id=88&option=com_virtuemart&Itemid=2"
["product_thumb_image"]=> string(170) "http://www.e-theodoulidis.gr/components/com_virtuemart/show_image_in_imgtag.php?filename=General_Electric_4e5f4d8265044.jpg&newxsize=120&newysize=120&fileout="
["product_full_image"]=> string(108) "http://www.e-theodoulidis.gr/components/com_virtuemart/shop_image/product/General_Electric_4e5f4d8265044.jpg"
["full_image_width"]=> int(1064)
["full_image_height"]=> int(1064)
["product_name"]=> string(42) "General Electric Τηλέγωνο CE 30044"
["product_s_desc"]=> string(0) ""
["product_details"]=> string(43) "Λεπτομέρειες προϊόντος"
["product_rating"]=> string(0) ""
["product_price"]=> string(344) " Καλέστε για Τιμή "
["product_price_raw"]=> array(1) {
["product_price"]=> float(0)
}
["product_sku"]=> string(25) "General Electric CE 30044"
["product_weight"]=> string(6) "0.0000"
["product_weight_uom"]=> string(2) "kg"
["product_length"]=> string(6) "0.0000"
["product_width"]=> string(6) "0.0000"
["product_height"]=> string(6) "0.0000"
["product_lwh_uom"]=> string(6) "inches"
["product_in_stock"]=> string(1) "0"
["product_availability_date"]=> NULL
["product_availability"]=> string(0) ""
["cdate"]=> string(10) "1314868610"
["mdate"]=> string(10) "1314868610"
}
["0_2"]=> array(27) {
["files"]=> array(0) { }
["images"]=> array(0) { }
["form_addtocart"]=> string(0) ""
["has_addtocart"]=> bool(false)
["product_flypage"]=> string(137) "index.php?page=shop.product_details&flypage=flypage.tpl&product_id=7609&category_id=88&option=com_virtuemart&Itemid=2"
["product_thumb_image"]=> string(188) "http://www.e-theodoulidis.gr/components/com_virtuemart/show_image_in_imgtag.php?filename=resized%2FPanasonic________533a7b4f573b0_120x120.jpg&newxsize=120&newysize=120&fileout="
["product_full_image"]=> string(108) "http://www.e-theodoulidis.gr/components/com_virtuemart/shop_image/product/Panasonic________533a7b4f5cba6.jpg"
["full_image_width"]=> int(530)
["full_image_height"]=> int(403)
["product_name"]=> string(39) "Panasonic Τηλέφωνο KX-TS560EX2B"
["product_s_desc"]=> string(0) ""
["product_details"]=> string(43) "Λεπτομέρειες προϊόντος"
["product_rating"]=> string(0) ""
["product_price"]=> string(339) " Καλέστε για Τιμή "
["product_price_raw"]=> array(1) {
["product_price"]=> float(0)
}
["product_sku"]=> string(22) "Panasonic KX-TS560EX2B"
["product_weight"]=> string(6) "0.0000"
["product_weight_uom"]=> string(2) "kg"
["product_length"]=> string(6) "0.0000"
["product_width"]=> string(6) "0.0000"
["product_height"]=> string(6) "0.0000"
["product_lwh_uom"]=> string(6) "inches"
["product_in_stock"]=> string(1) "0"
["product_availability_date"]=> NULL
["product_availability"]=> string(0) ""
["cdate"]=> string(10) "1396341583"
["mdate"]=> string(10) "1426577025"
}
}
Upvotes: 0
Views: 64
Reputation: 536
Those on the left (eg. "0_1") are the array keys, and the values are the ones on the right.
To get just the keys, use:
$arrayOfKeys = array_keys($array)
or to iterate over each item, use:
foreach ($array as $key => $value) { }
Upvotes: 2