3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr= array ( 'supplier_id' => 1, 'filter_name' => array ( 0 => 'product 1', 1 => 'Product 2', 2 => 'Product 3' ), 'quantity' => array ( 0 => 3, 1 => 10, 2 => 2 ), 'unit' => array ( 0 => 'pkts', 1 => 'ltrs', 2 => 'pkts' ), 'price' => Array ( 0 => 11, 1 => 100, 2 => 10 ), 'gross_amount' => Array ( 0 => 33, 1 => 1000, 2 => 20 ), 'vat' => array ( 0 => 0, 1 => 0, 2 => 0 ), 'net_amount' => array ( 0 => 33, 1 => 1000, 2 => 20 ), ); //echo "<pre>"; print_r($arr); $i = 0; $newArray = array(); do{ foreach($arr as $key=>$val){ if($key == 'supplier_id'){ $newArray[$key] = $val; }else{ $newArray[$i][$key] = $val[$i]; } } $i++; }while($i<3); echo "<pre>"; print_r($newArray);
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [supplier_id] => 1 [0] => Array ( [filter_name] => product 1 [quantity] => 3 [unit] => pkts [price] => 11 [gross_amount] => 33 [vat] => 0 [net_amount] => 33 ) [1] => Array ( [filter_name] => Product 2 [quantity] => 10 [unit] => ltrs [price] => 100 [gross_amount] => 1000 [vat] => 0 [net_amount] => 1000 ) [2] => Array ( [filter_name] => Product 3 [quantity] => 2 [unit] => pkts [price] => 10 [gross_amount] => 20 [vat] => 0 [net_amount] => 20 ) )

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:
26.1 ms | 407 KiB | 5 Q