3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-type: text/plain'); $metaarr = array( array( "post_id" => '34', "meta_key" => "product_shops_0_price", "meta_value"=> "25" ), array( "post_id" => '34', "meta_key" => "product_shops_0_price_old", "meta_value"=> "45" ), array( "post_id" => '34', "meta_key" => "product_shops_1_price", "meta_value"=> "25" ), array( "post_id" => '34', "meta_key" => "product_shops_1_price_old", "meta_value"=> "45" ) ); $map = array(); foreach ($metaarr as $key => $value) { $splarr = preg_match('/^(product_shops_\d*)_(\S*)/', $value['meta_key'], $matches); $product_offset = $matches[1]; $map[$value['post_id']][$product_offset][$value['meta_key']] = $value['meta_value']; } print_r($map);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [34] => Array ( [product_shops_0] => Array ( [product_shops_0_price] => 25 [product_shops_0_price_old] => 45 ) [product_shops_1] => Array ( [product_shops_1_price] => 25 [product_shops_1_price_old] => 45 ) ) )

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:
128.15 ms | 406 KiB | 5 Q