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 (array_flip($firstArray) as $index) { $new1[] = $firstArray[$index]; $new2[] = $secondArray[$index]; $new3[] = $thirdArray[$index]; } var_dump($new1, $new2, $new3);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
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" }
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
110.4 ms | 407 KiB | 5 Q