3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 44259 => [50007, 50009, 46372], 50007 => [50008], 50009 => [50010], 66666 => ['do', 'not', 'push'], 46372 => [46418, 46419, 46421], 46421 => [146880] ]; $mergedArray = []; foreach ($array as $subArray) { array_map(function($elm) { if (!in_array($elm, $mergedArray)) { $mergedArray[] = $elm; }, $subArray); } var_export($mergedArray);
Output for 8.0.1 - 8.0.23, 8.1.0 - 8.1.10
Parse error: syntax error, unexpected token "," in /in/RtUHE on line 17
Process exited with code 255.
Output for 7.4.0 - 7.4.30
Parse error: syntax error, unexpected ',' in /in/RtUHE on line 17
Process exited with code 255.

preferences:
161.33 ms | 999 KiB | 7 Q