3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); class BinarySearch { /** * @param mixed[] $items */ public function __invoke(array $items): int { for ($start = 0, $end = count($items); $i = $start + (int) (($end - $start) / 2), $i < $end; ) { // do something here break; } return $i; } } $binarySearch = new BinarySearch(); var_dump($binarySearch([])); var_dump($binarySearch([0, 1, 2, 3])); var_dump($binarySearch([0, 1, 2, 3, 4, 5, 6])); var_dump($binarySearch([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]));

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.5.30.0040.00417.58
8.5.20.0080.00819.81
8.5.10.0090.00716.60
8.5.00.0150.00620.06
8.4.180.0140.00822.07
8.4.170.0120.01020.75
8.4.160.0160.00523.13
8.4.150.0080.00516.84
8.4.140.0140.01117.37
8.4.130.0150.00617.82
8.4.120.0020.00622.43
8.4.110.0100.00722.28
8.4.100.0060.00318.69
8.4.90.0110.00918.76
8.4.80.0080.01118.81
8.4.70.0120.00818.18
8.4.60.0140.00718.87
8.4.50.0030.00618.70
8.4.40.0100.01018.00
8.4.30.0000.01120.56
8.4.20.0060.00324.41
8.4.10.0090.00919.25
8.3.300.0150.00420.71
8.3.290.0140.00620.86
8.3.280.0120.00818.36
8.3.270.0140.00716.60
8.3.260.0060.00416.61
8.3.250.0110.00818.95
8.3.240.0100.00918.69
8.3.230.0120.00816.45
8.3.220.0020.00518.88
8.3.210.0100.00516.45
8.3.200.0070.00816.49
8.3.190.0130.00616.93
8.3.180.0040.00416.75
8.3.170.0090.00920.91
8.3.160.0110.00417.14
8.3.150.0070.01117.12
8.3.140.0070.00016.43
8.3.130.0150.00316.78
8.3.120.0150.00418.91
8.3.110.0090.00018.29
8.3.100.0040.00716.14
8.3.90.0050.00218.39
8.3.80.0060.00319.36
8.3.70.0170.01416.75
8.3.60.0170.00316.38
8.3.50.0100.00823.54
8.3.40.0170.00322.22
8.3.30.0130.00318.72
8.3.20.0060.00324.18
8.3.10.0080.00024.66
8.3.00.0080.00026.16
8.2.300.0120.01018.12
8.2.290.0100.01020.27
8.2.280.0090.01018.45
8.2.270.0080.00017.09
8.2.260.0090.00916.71
8.2.250.0140.00016.47
8.2.240.0090.00017.29
8.2.230.0040.00420.94
8.2.220.0070.00324.06
8.2.210.0070.00326.77
8.2.200.0030.00616.38
8.2.190.0040.01516.75
8.2.180.0100.01025.92
8.2.170.0150.00618.96
8.2.160.0070.00722.96
8.2.150.0060.00325.66
8.2.140.0040.00424.66
8.2.130.0090.00926.16
8.2.120.0040.00420.69
8.2.110.0060.00620.96
8.2.100.0080.00318.03
8.2.90.0000.00819.26
8.2.80.0050.00317.97
8.2.70.0030.00817.50
8.2.60.0000.00817.63
8.2.50.0000.00818.05
8.2.40.0080.00018.14
8.2.30.0000.00717.96
8.2.20.0070.00017.93
8.2.10.0050.00219.27
8.2.00.0080.00019.30
8.1.340.0120.00817.62
8.1.330.0030.00522.04
8.1.320.0140.00716.20
8.1.310.0070.01116.64
8.1.300.0090.00918.50
8.1.290.0000.01218.88
8.1.280.0140.00025.92
8.1.270.0040.00423.99
8.1.260.0090.00626.35
8.1.250.0000.00828.09
8.1.240.0070.00422.02
8.1.230.0070.00420.84
8.1.220.0040.00417.77
8.1.210.0040.00418.77
8.1.200.0040.00417.35
8.1.190.0000.00817.25
8.1.180.0030.00618.10
8.1.170.0000.00818.59
8.1.160.0040.00418.84
8.1.150.0040.00418.92
8.1.140.0080.00018.77
8.1.130.0040.00420.18
8.1.120.0000.00817.36
8.1.110.0040.00417.45
8.1.100.0030.00317.44
8.1.90.0080.00017.44
8.1.80.0030.00617.39
8.1.70.0030.00317.34
8.1.60.0000.00917.47
8.1.50.0080.00417.50
8.1.40.0050.00317.50
8.1.30.0040.00417.57
8.1.20.0000.00717.60
8.1.10.0040.00417.57
8.1.00.0030.00717.50
8.0.300.0000.00719.15
8.0.290.0070.00016.75
8.0.280.0000.00718.29
8.0.270.0000.00718.00
8.0.260.0000.00718.32
8.0.250.0070.00016.95
8.0.240.0050.00316.82
8.0.230.0000.00716.86
8.0.220.0000.00716.75
8.0.210.0040.00416.88
8.0.200.0000.00616.84
8.0.190.0040.00416.89
8.0.180.0070.00016.79
8.0.170.0060.00516.94
8.0.160.0000.00716.75
8.0.150.0030.00516.71
8.0.140.0000.00716.76
8.0.130.0000.00613.36
8.0.120.0000.00816.88
8.0.110.0000.00816.66
8.0.100.0000.00716.95
8.0.90.0070.00016.87
8.0.80.0060.01016.83
8.0.70.0030.00616.75
8.0.60.0000.00716.80
8.0.50.0080.00016.68
8.0.30.0100.00717.03
8.0.20.0070.01217.24
8.0.10.0040.00416.86
8.0.00.0030.01416.67
7.4.330.0000.00415.55
7.4.320.0060.00016.52
7.4.300.0000.00616.51
7.4.290.0000.00816.50
7.4.280.0030.00516.57
7.4.270.0030.00316.47
7.4.260.0000.00613.29
7.4.250.0040.00416.48
7.4.240.0040.00416.58
7.4.230.0040.00316.67
7.4.220.0050.00316.52
7.4.210.0030.01316.52
7.4.200.0030.00516.48
7.4.130.0110.00916.48
7.4.120.0160.00316.43
7.4.110.0070.01116.37
7.4.100.0120.00616.30
7.4.90.0090.01316.32
7.4.80.0070.01716.29
7.4.70.0120.00616.54
7.4.60.0100.00716.22
7.4.50.0080.00816.37
7.4.40.0090.00916.43
7.4.30.0090.01316.48
7.4.20.0030.02116.29
7.4.10.0110.01216.57
7.4.00.0160.01016.44
7.3.330.0000.00716.26
7.3.320.0050.00013.13
7.3.310.0040.00416.32
7.3.300.0030.00316.21
7.3.290.0090.00716.30
7.3.260.0070.01016.49
7.3.230.0050.01116.59
7.3.220.0150.00616.36
7.3.210.0070.01016.23
7.3.200.0080.01116.36
7.3.190.0120.00616.41
7.3.180.0100.01016.21
7.3.170.0030.01716.34
7.3.160.0040.01616.32
7.3.150.0160.00616.52
7.3.140.0090.01316.58
7.3.130.0220.00316.55
7.3.120.0060.01516.31
7.3.110.0070.00216.19
7.3.100.0140.01116.34
7.3.90.0080.00616.62
7.3.80.0170.00716.30
7.3.70.0060.01516.31
7.3.60.0150.00916.31
7.3.50.0120.00816.44
7.3.40.0130.01016.42
7.3.30.0100.01016.44
7.3.20.0080.01416.50
7.3.10.0180.00716.34
7.3.00.0090.01316.34
7.2.330.0100.00916.73
7.2.320.0000.01916.52
7.2.310.0100.01016.63
7.2.300.0060.01316.50
7.2.290.0070.01616.47
7.2.280.0090.01516.48
7.2.270.0120.00916.39
7.2.260.0100.01716.60
7.2.250.0130.01016.71
7.2.240.0100.01316.63
7.2.230.0100.01316.49
7.2.220.0120.01116.47
7.2.210.0120.01216.46
7.2.200.0120.00916.63
7.2.190.0170.00716.47
7.2.180.0060.01516.62
7.2.170.0190.00316.47
7.2.160.0100.01016.59
7.2.150.0170.00716.62
7.2.140.0170.01016.63
7.2.130.0120.01216.62
7.2.120.0120.00916.65
7.2.110.0180.00716.66
7.2.100.0190.00316.70
7.2.90.0100.01016.60
7.2.80.0300.01216.66
7.2.70.0160.00416.90
7.2.60.0100.01016.55
7.2.50.0130.01016.56
7.2.40.0140.01016.77
7.2.30.0070.02016.68
7.2.20.0000.02416.54
7.2.10.0140.00616.54
7.2.00.0120.00816.51

preferences:
33.71 ms | 475 KiB | 5 Q