3v4l.org

run code in 300+ PHP versions simultaneously
<?php $firstArray = array('22','24','23','26','22','24','23','26'); $secondArray = array('John','Smith','Mark','Steve','George','Nick','Sean','Brad'); $thirdArray = array('A','B','D','E','F','G','H','I'); $new1 = []; $new2 = []; $new3 = []; foreach ($firstArray as $index => $value) { if (!isset($ref[$value])) { $new1[] = &$ref[$value][0]; $new2[] = &$ref[$value][1]; $new3[] = &$ref[$value][2]; } $ref[$value][0] = $value; $ref[$value][1] = $secondArray[$index]; $ref[$value][2] = $thirdArray[$index]; } var_dump($new1, $new2, $new3);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> &string(2) "22" [1]=> &string(2) "24" [2]=> &string(2) "23" [3]=> &string(2) "26" } array(4) { [0]=> &string(6) "George" [1]=> &string(4) "Nick" [2]=> &string(4) "Sean" [3]=> &string(4) "Brad" } array(4) { [0]=> &string(1) "F" [1]=> &string(1) "G" [2]=> &string(1) "H" [3]=> &string(1) "I" }

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