3v4l.org

run code in 300+ PHP versions simultaneously
<?php $loops = 100000; $start = microtime(true); for ($l = 0; $l < $loops; $l++) { $x = [1,2,3,4,6,7,8,9]; for ($i = 0; $i <= 10; $i++) { if (!in_array($i, $x)) { $x[] = $i; } } } $duration = microtime(true) - $start; echo "in_array took $duration<br>".PHP_EOL; $start = microtime(true); for ($l = 0; $l < $loops; $l++) { $x = [1,2,3,4,6,7,8,9]; $x = array_values(array_unique(array_merge($x, [0,1,2,3,4,5,6,7,8,9,10]))); } $duration = microtime(true) - $start; echo "array_unique took $duration<br>".PHP_EOL;

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.40.0070.09817.74
8.3.170.0130.10518.86
8.2.80.0120.09917.53
8.1.310.0180.07515.88
8.1.90.0030.10217.33
8.1.80.0030.10917.47
8.1.70.0100.09717.43
8.1.60.0040.10217.51
8.1.50.0070.09917.39
8.1.40.0200.09517.46
8.1.30.0070.10717.58
8.1.20.0070.10317.69
8.1.10.0100.10117.45
8.1.00.0060.10417.40
8.0.220.0130.09016.82
8.0.210.0030.10416.79
8.0.200.0130.09016.81
8.0.190.0100.09916.79
8.0.180.0030.10016.87
8.0.170.0070.09816.94
8.0.160.0030.10116.76
8.0.150.0100.09416.83
8.0.140.0070.10416.83
8.0.130.0100.10216.89
8.0.120.0100.11116.88
8.0.110.0100.11616.93
8.0.100.0030.11916.72
8.0.90.0030.11616.78
8.0.80.0070.11916.88
8.0.70.0000.12516.78
8.0.60.0030.11816.88
8.0.50.0030.12316.79
8.0.30.0120.16416.89
8.0.20.0050.16116.78
8.0.10.0130.18416.97
8.0.00.0100.16916.95
7.4.300.0100.10016.61
7.4.290.0100.10616.46
7.4.280.0030.11616.58
7.4.270.0170.10516.50
7.4.260.0200.10116.48
7.4.250.0130.10416.45
7.4.240.0030.11416.55
7.4.230.0130.10416.45
7.4.220.0130.09716.44
7.4.210.0160.09416.38
7.4.200.0100.10416.48
7.4.190.0070.10416.54
7.4.180.0070.10016.52
7.4.160.0130.15916.44
7.4.150.0120.19816.31
7.4.140.0100.15216.43
7.4.130.0120.16616.41
7.4.120.0110.18516.37
7.4.110.0130.19616.45
7.4.100.0090.17716.38
7.4.90.0070.16716.37
7.4.80.0100.15716.32
7.4.70.0100.18116.40
7.4.60.0110.18216.51
7.4.50.0130.15916.51
7.4.40.0140.17716.41
7.4.30.0130.17916.35
7.4.20.0180.19216.39
7.4.10.0090.15716.45
7.4.00.0100.18216.50
7.3.330.0130.10916.11
7.3.320.0170.10716.27
7.3.310.0070.11716.39
7.3.300.0070.11416.25
7.3.290.0130.10816.17
7.3.280.0030.12016.18
7.3.270.0130.17316.27
7.3.260.0150.17416.33
7.3.250.0130.19516.36
7.3.240.0150.16616.42
7.3.230.0120.16816.40
7.3.220.0180.19116.28
7.3.210.0210.16016.40
7.3.200.0150.18216.24
7.3.190.0170.17716.31
7.3.180.0110.20516.31
7.3.170.0130.18716.29
7.3.160.0120.18416.27
7.3.150.0090.21016.28
7.3.140.0080.16416.30
7.3.130.0070.17716.16
7.3.120.0120.15516.19
7.3.110.0100.17816.36
7.3.100.0140.17716.26
7.3.90.0100.16016.47
7.3.80.0110.17116.42
7.3.70.0080.21116.34
7.3.60.0150.19016.32
7.3.50.0140.21916.43
7.3.40.0140.16416.34
7.3.30.0060.18916.27
7.3.20.0110.16917.38
7.3.10.0080.18917.18
7.3.00.0120.16417.25

preferences:
49.58 ms | 403 KiB | 5 Q