3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cart_array = json_decode('{ "items":[ { "count":"1", "cart_id":123, "plu":"TP16", "description":"Bag" }, { "count":1, "cart_id":1234, "plu":"DISCT10", "description":"10% Discount" } ], "total":9.9, "discount_total":9.9 }', true); $cart_array['items'] = array_column($cart_array['items'], NULL, 'cart_id'); Var_dump($cart_array);
Output for git.master_jit, git.master, rfc.property-hooks
array(3) { ["items"]=> array(2) { [123]=> array(4) { ["count"]=> string(1) "1" ["cart_id"]=> int(123) ["plu"]=> string(4) "TP16" ["description"]=> string(3) "Bag" } [1234]=> array(4) { ["count"]=> int(1) ["cart_id"]=> int(1234) ["plu"]=> string(7) "DISCT10" ["description"]=> string(12) "10% Discount" } } ["total"]=> float(9.9) ["discount_total"]=> float(9.9) }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
124.36 ms | 407 KiB | 5 Q