3v4l.org

run code in 300+ PHP versions simultaneously
<?php $something = [3, 2, 1, 3, 6, 5, 1, 1]; $liste = []; foreach ($something as $value) { $liste[$value] = $value; } var_export($liste);
Output for 7.4.0 - 7.4.28, 7.4.30 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.1, 8.1.3 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
array ( 3 => 3, 2 => 2, 1 => 1, 6 => 6, 5 => 5, )
Output for 7.4.29, 8.1.2

Process exited with code 137.
Output for 5.3.14
Parse error: syntax error, unexpected '[' in /in/FmsUL on line 3
Process exited with code 255.

preferences:
110.82 ms | 408 KiB | 5 Q