3v4l.org

run code in 300+ PHP versions simultaneously
<?php $purchases = array( array('product_id' => 7, 'receipt' => "R13D13"), array('product_id' => 5, 'receipt' => "Y28Z14"), array('product_id' => 7, 'receipt' => "R02310"), array('product_id' => 5, 'receipt' => "E11403") ); $result = []; foreach($purchases as $key => $purchase) { if (!isset($result[$purchase["product_id"]])) { $result[$purchase["product_id"]] = $purchase; } } print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [7] => Array ( [product_id] => 7 [receipt] => R13D13 ) [5] => Array ( [product_id] => 5 [receipt] => Y28Z14 ) )

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