3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array("purchase_order_details_id"=>array( 0=>"POD1", 1=>"POD1", 2=>"POD2", ), "quantity_received"=>array( 0=>5, 1=>10, 2=>20 ) ); $pods = array_unique($arr["purchase_order_details_id"]); Foreach($pods as $pod){ $PO = array_intersect($arr["purchase_order_details_id"], [$pod]); $qt = array_intersect_key($arr["quantity_received"], $PO); $new[$pod] = ["purchase_order_details_id" => $PO, "quantity_received" => $qt]; } Var_dump($new); extract($new);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { ["POD1"]=> array(2) { ["purchase_order_details_id"]=> array(2) { [0]=> string(4) "POD1" [1]=> string(4) "POD1" } ["quantity_received"]=> array(2) { [0]=> int(5) [1]=> int(10) } } ["POD2"]=> array(2) { ["purchase_order_details_id"]=> array(1) { [2]=> string(4) "POD2" } ["quantity_received"]=> array(1) { [2]=> int(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:
25.75 ms | 406 KiB | 5 Q