3v4l.org

run code in 300+ PHP versions simultaneously
<?php $products = [ (object)["item_id" => "89", "name" => "Confiture de Myrtilles", "product_id" => "737", "meta_key" => "vmm_warehouse_sg_10783", "meta_value" => "0" ], (object)["item_id" => "89", "name" => "Confiture de Myrtilles", "product_id" => "737", "meta_key" => "vmm_warehouse_sg_10782", "meta_value" => "0" ], (object)["item_id" => "91", "name" => "Poires Guyot (bio)", "product_id" => "690", "meta_key" => "_backorders", "meta_value" => "no" ], (object)["item_id" => "91", "name" => "Poires Guyot (bio)", "product_id" => "690", "meta_key" => "_sold_individually", "meta_value" => "no" ] ]; $result = []; foreach($products as $product) { $result[$product->item_id][$product->meta_key] = $product->meta_value; } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 89 => array ( 'vmm_warehouse_sg_10783' => '0', 'vmm_warehouse_sg_10782' => '0', ), 91 => array ( '_backorders' => 'no', '_sold_individually' => 'no', ), )

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:
27.8 ms | 405 KiB | 5 Q