3v4l.org

run code in 300+ PHP versions simultaneously
<?php $max = 1000000; $arr = range(1,$max,3); $arr2 = range(1,$max,2); $arr = array_merge($arr,$arr2); $time = -microtime(true); $res1 = array_unique($arr); $time += microtime(true); echo "deduped to ".count($res1)." in ".$time; // deduped to 666667 in 32.300781965256 $time = -microtime(true); $res2 = array(); foreach($arr as $key=>$val) { $res2[$val] = true; } $res2 = array_keys($res2); $time += microtime(true); echo "<br />deduped to ".count($res2)." in ".$time; // deduped to 666667 in 0.84372591972351
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/h2stK on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/h2stK on line 4
Process exited with code 255.
Output for 5.2.7 - 5.2.17
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24 bytes) in /in/h2stK on line 4
Process exited with code 255.
Output for 5.2.6
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in /in/h2stK on line 4
Process exited with code 255.
Output for 5.2.1 - 5.2.5
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 2097152 bytes) in /in/h2stK on line 4
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6, 5.2.0

Process exited with code 137.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/h2stK on line 21
Process exited with code 255.
Output for 4.4.9
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 2.3999999999968E-05<br />deduped to 0 in 7.0000000000348E-06
Output for 4.4.8
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 1.8999999999991E-05<br />deduped to 0 in 5.0000000000328E-06
Output for 4.4.7
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 2.2000000000022E-05<br />deduped to 0 in 5.0000000000328E-06
Output for 4.4.6
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 2.9000000000001E-05<br />deduped to 0 in 5.0000000000328E-06
Output for 4.4.5
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 1.8000000000018E-05<br />deduped to 0 in 4.9999999999772E-06
Output for 4.4.4
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 1.8999999999991E-05<br />deduped to 0 in 4.9999999999772E-06
Output for 4.4.3
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 2.2000000000078E-05<br />deduped to 0 in 4.9999999999217E-06
Output for 4.4.2
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 1.7999999999962E-05<br />deduped to 0 in 5.0000000000328E-06
Output for 4.4.1
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 1.9000000000102E-05<br />deduped to 0 in 5.0000000000328E-06
Output for 4.4.0
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 2.2000000000078E-05<br />deduped to 0 in 8.000000000008E-06
Output for 4.3.11
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 1.6000000000016E-05<br />deduped to 0 in 4.000000000004E-06
Output for 4.3.10
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 2.1999999999966E-05<br />deduped to 0 in 6.9999999999792E-06
Output for 4.3.9
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 4.4000000000044E-05<br />deduped to 0 in 5.0000000000328E-06
Output for 4.3.8
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 4.0999999999958E-05<br />deduped to 0 in 5.9999999999505E-06
Output for 4.3.7
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 4.7000000000019E-05<br />deduped to 0 in 7.0000000000903E-06
Output for 4.3.6
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 4.4000000000044E-05<br />deduped to 0 in 7.0000000000903E-06
Output for 4.3.5
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 5.1000000000023E-05<br />deduped to 0 in 9.9999999999545E-06
Output for 4.3.4
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 5.2E-05<br />deduped to 0 in 5.9999999999991E-06
Output for 4.3.3
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 5.4999999999999E-05<br />deduped to 0 in 7.9999999999941E-06
Output for 4.3.2
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 4.2E-05<br />deduped to 0 in 5.000000000005E-06
Output for 4.3.1
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 4.4999999999989E-05<br />deduped to 0 in 5.000000000005E-06
Output for 4.3.0
Warning: Wrong parameter count for range() in /in/h2stK on line 3 Warning: Wrong parameter count for range() in /in/h2stK on line 4 deduped to 0 in 2.0999999999993E-05<br />deduped to 0 in 8.000000000008E-06

preferences:
209.67 ms | 401 KiB | 325 Q