3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'code' => '001', 'name' => 'Prostite', 'whpr' => [ 'wh_price_rest' => [ ['price' => 255, 'wrh' => 1], ['price'=> 900, 'wrh' => 5] ] ] ], [ 'code' => '002', 'name' => 'Menya', 'whpr' => [ 'wh_price_rest' => [ ['price' => 34535, 'wrh' => 42], ['price'=> 5445, 'wrh' => 2432] ] ] ], ]; $result = []; foreach ($array as $item) { foreach ($item['whpr']['wh_price_rest'] as $key => $value) { unset($item['whpr']); foreach ($value as $k => $v) $item[$k] = $v; $result[] = $item; } } print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [code] => 001 [name] => Prostite [price] => 255 [wrh] => 1 ) [1] => Array ( [code] => 001 [name] => Prostite [price] => 900 [wrh] => 5 ) [2] => Array ( [code] => 002 [name] => Menya [price] => 34535 [wrh] => 42 ) [3] => Array ( [code] => 002 [name] => Menya [price] => 5445 [wrh] => 2432 ) )

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:
61.38 ms | 402 KiB | 8 Q