3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array ( 0 => array ( 'reference_no' => 'A0012', 'code' => 'HSWH30', 'net_unit_price' => '24000', 'quantity' => '2', ), 1 => array ( 'reference_no' => 'A0012', 'code' => 'HSWH15', 'net_unit_price' => '21000', 'quantity' => '2', ), 2 => array ( 'reference_no' => 'A0013', 'code' => 'HS-106AR', 'net_unit_price' => '2400', 'quantity' => '1', ), 3 => array ( 'reference_no' => 'A0013', 'code' => 'HS-8012', 'net_unit_price' => '4500', 'quantity' => '2', ), ); foreach($arr as $sub){ $new[$sub['reference_no']][] = $sub; } $new = array_values($new); var_dump($new);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(2) { [0]=> array(4) { ["reference_no"]=> string(5) "A0012" ["code"]=> string(6) "HSWH30" ["net_unit_price"]=> string(5) "24000" ["quantity"]=> string(1) "2" } [1]=> array(4) { ["reference_no"]=> string(5) "A0012" ["code"]=> string(6) "HSWH15" ["net_unit_price"]=> string(5) "21000" ["quantity"]=> string(1) "2" } } [1]=> array(2) { [0]=> array(4) { ["reference_no"]=> string(5) "A0013" ["code"]=> string(8) "HS-106AR" ["net_unit_price"]=> string(4) "2400" ["quantity"]=> string(1) "1" } [1]=> array(4) { ["reference_no"]=> string(5) "A0013" ["code"]=> string(7) "HS-8012" ["net_unit_price"]=> string(4) "4500" ["quantity"]=> string(1) "2" } } }

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:
34.26 ms | 408 KiB | 5 Q