3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "this is a long string"; $length = strlen($str); $dir = -1; $delta = $length; $maxlength = 12; while($delta){ $delta = $delta / 2; $length = $length + $dir * $delta; if($dir * (strlen(substr($str, 0, $length)) - $maxlength) > 0) $dir = -$dir; echo substr($str, 0, $length). "\n"; } ?>

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.3.60.0090.00916.75
8.3.50.0070.01116.27
8.3.40.0120.00618.67
8.3.30.0070.01118.80
8.3.20.0120.00022.10
8.3.10.0060.00323.62
8.3.00.0210.00821.84
8.2.180.0170.00318.42
8.2.170.0060.01222.96
8.2.160.0170.01119.13
8.2.150.0150.01024.18
8.2.140.0030.00624.66
8.2.130.0110.00720.98
8.2.120.0000.00926.35
8.2.110.0100.00022.12
8.2.100.0100.00617.79
8.2.90.0050.00319.21
8.2.80.0000.00818.05
8.2.70.0000.00817.63
8.2.60.0040.00417.93
8.2.50.0050.00318.10
8.2.40.0000.00820.48
8.2.30.0040.00419.20
8.2.20.0080.00018.27
8.2.10.0030.00518.21
8.2.00.0040.00418.07
8.1.280.0150.00625.92
8.1.270.0030.00622.14
8.1.260.0060.00326.35
8.1.250.0080.00028.09
8.1.240.0040.00720.98
8.1.230.0120.00019.14
8.1.220.0040.00417.75
8.1.210.0060.00618.77
8.1.200.0040.00717.35
8.1.190.0090.00017.10
8.1.180.0090.00318.10
8.1.170.0050.00320.66
8.1.160.0050.00319.07
8.1.150.0040.00420.87
8.1.140.0040.00419.64
8.1.130.0070.00318.91
8.1.120.0030.00617.44
8.1.110.0060.00317.51
8.1.100.0040.00417.47
8.1.90.0000.00817.48
8.1.80.0040.00417.53
8.1.70.0040.00417.42
8.1.60.0040.00417.65
8.1.50.0000.00917.51
8.1.40.0060.00317.63
8.1.30.0080.00017.55
8.1.20.0040.00417.57
8.1.10.0040.01217.63
8.1.00.0040.00417.42
8.0.300.0060.00322.01
8.0.290.0080.00016.63
8.0.280.0050.00318.55
8.0.270.0060.00317.23
8.0.260.0070.00016.82
8.0.250.0040.00416.85
8.0.240.0080.00016.94
8.0.230.0030.00516.95
8.0.220.0040.00416.89
8.0.210.0020.00516.89
8.0.200.0020.00516.84
8.0.190.0060.00316.96
8.0.180.0030.00716.77
8.0.170.0030.00616.93
8.0.160.0040.00416.86
8.0.150.0040.00416.89
8.0.140.0070.00316.76
8.0.130.0030.00313.35
8.0.120.0030.00516.75
8.0.110.0060.00316.73
8.0.100.0000.00816.91
8.0.90.0040.00416.89
8.0.80.0130.00916.83
8.0.70.0080.00016.93
8.0.60.0000.00816.84
8.0.50.0000.00816.76
8.0.30.0100.01217.26
8.0.20.0160.00917.40
8.0.10.0040.00416.77
8.0.00.0180.01216.63
7.4.330.0040.00415.55
7.4.320.0080.00016.34
7.4.300.0070.00016.58
7.4.290.0030.00516.53
7.4.280.0050.00316.43
7.4.270.0040.00416.50
7.4.260.0000.00916.53
7.4.250.0080.00016.54
7.4.240.0080.00016.42
7.4.230.0000.00716.55
7.4.220.0120.00816.57
7.4.210.0130.00716.49
7.4.200.0040.00416.53
7.4.160.0100.01216.44
7.4.150.0140.01017.40
7.4.140.0130.01217.86
7.4.130.0080.01916.52
7.4.120.0110.01316.44
7.4.110.0120.00916.36
7.4.100.0210.00716.52
7.4.90.0120.00916.36
7.4.80.0070.01319.39
7.4.70.0050.01516.62
7.4.60.0030.01816.52
7.4.50.0070.01016.35
7.4.40.0120.00916.57
7.4.30.0070.01316.57
7.4.00.0070.01114.79
7.3.330.0000.00513.23
7.3.320.0030.00313.15
7.3.310.0050.00316.25
7.3.300.0000.00716.30
7.3.290.0040.00416.35
7.3.280.0090.01216.29
7.3.270.0040.01817.40
7.3.260.0110.01216.48
7.3.250.0140.00916.25
7.3.240.0140.00916.44
7.3.230.0060.01516.60
7.3.210.0170.00416.34
7.3.200.0110.01116.34
7.3.190.0200.00616.39
7.3.180.0100.01516.51
7.3.170.0100.01716.41
7.3.160.0120.00916.34
7.3.120.0060.00915.03
7.3.110.0040.01414.87
7.3.100.0110.00715.14
7.3.90.0090.00915.05
7.3.80.0060.00614.67
7.3.70.0070.01014.90
7.3.60.0070.01114.98
7.3.50.0120.00314.73
7.3.40.0160.00014.92
7.3.30.0080.00414.88
7.3.20.0030.01316.73
7.3.10.0040.00816.56
7.3.00.0140.00316.70
7.2.330.0030.02016.61
7.2.320.0070.01416.52
7.2.310.0140.00616.67
7.2.300.0110.01016.66
7.2.290.0080.01316.48
7.2.240.0100.00314.95
7.2.230.0120.00614.59
7.2.220.0060.00914.91
7.2.210.0070.01015.24
7.2.200.0000.01614.95
7.2.190.0070.01114.93
7.2.180.0100.00714.87
7.2.170.0070.01015.04
7.2.160.0100.01015.12
7.2.150.0030.01316.90
7.2.140.0040.01416.92
7.2.130.0030.01016.92
7.2.120.0080.00816.71
7.2.110.0000.01516.83
7.2.100.0100.00717.03
7.2.90.0040.01116.93
7.2.80.0040.01516.82
7.2.70.0030.01317.06
7.2.60.0060.00916.84
7.2.50.0100.00816.95
7.2.40.0030.01616.82
7.2.30.0150.00316.56
7.2.20.0090.00917.06
7.2.10.0070.01116.73
7.2.00.0090.00616.93
7.1.330.0130.00615.97
7.1.320.0040.01415.63
7.1.310.0030.01015.77
7.1.300.0030.00915.84
7.1.290.0070.00715.86
7.1.280.0090.00915.90
7.1.270.0040.01115.90
7.1.260.0040.01515.84
7.1.250.0040.01215.78
7.1.200.0070.01015.60
7.1.70.0100.00716.94
7.1.60.0290.02035.05
7.1.50.0240.00734.88
7.1.40.0200.01034.34
7.1.30.0150.01734.40
7.1.20.0230.01034.52
7.1.10.0040.01816.30
7.1.00.0040.01116.34
7.0.200.0040.01816.54
7.0.190.0070.01116.80
7.0.180.0110.00616.28
7.0.170.0110.00916.14
7.0.160.0100.01216.18
7.0.150.0070.01016.24
7.0.140.0030.01516.33
7.0.130.0090.01216.57
7.0.120.0120.00816.60
7.0.110.0030.01516.30
7.0.100.0000.01716.25
7.0.90.0030.01316.30
7.0.80.0140.00716.29
7.0.70.0030.01216.40
7.0.60.0060.01316.03
7.0.50.0090.00616.29
7.0.40.0070.01016.44
7.0.30.0110.00716.50
7.0.20.0120.00616.48
7.0.10.0000.01416.63
7.0.00.0030.01016.63

preferences:
53.29 ms | 400 KiB | 5 Q