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(intval($delta)){ $delta = $delta / 2; $length = $length + $dir * $delta; if($dir * (strlen(substr($str, 0, $length)) - $maxlength) > 0) $dir = -$dir; echo substr($str, 0, $length)." ". $delta. "\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.70.0130.00318.55
8.3.60.0140.00716.75
8.3.50.0140.00416.74
8.3.40.0140.00318.79
8.3.30.0070.00718.79
8.3.20.0000.00722.09
8.3.10.0070.00023.48
8.3.00.0040.00422.04
8.2.180.0070.01116.63
8.2.170.0110.00422.96
8.2.160.0170.00319.08
8.2.150.0130.00624.18
8.2.140.0080.00024.66
8.2.130.0070.00021.07
8.2.120.0040.00426.35
8.2.110.0070.00322.13
8.2.100.0000.01217.84
8.2.90.0050.00319.17
8.2.80.0070.00318.05
8.2.70.0030.00617.75
8.2.60.0000.00818.03
8.2.50.0030.00618.10
8.2.40.0000.00720.57
8.2.30.0080.00021.04
8.2.20.0030.00318.07
8.2.10.0040.00418.14
8.2.00.0040.00418.11
8.1.280.0100.01025.92
8.1.270.0080.00022.21
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0050.00521.01
8.1.230.0040.00819.10
8.1.220.0030.00517.76
8.1.210.0030.00618.77
8.1.200.0090.00017.23
8.1.190.0000.00817.23
8.1.180.0050.00518.10
8.1.170.0070.00018.88
8.1.160.0070.00019.02
8.1.150.0070.00020.55
8.1.140.0000.00819.59
8.1.130.0070.00018.94
8.1.120.0030.00417.50
8.1.110.0060.00317.42
8.1.100.0040.00417.41
8.1.90.0040.00417.43
8.1.80.0030.00317.43
8.1.70.0030.00317.46
8.1.60.0050.00217.47
8.1.50.0040.00417.52
8.1.40.0040.00417.48
8.1.30.0030.00617.60
8.1.20.0000.00817.54
8.1.10.0000.00917.52
8.1.00.0040.00417.40
8.0.300.0040.00420.14
8.0.290.0000.00716.58
8.0.280.0070.00018.45
8.0.270.0000.00717.18
8.0.260.0050.00316.89
8.0.250.0000.00716.98
8.0.240.0050.00216.92
8.0.230.0030.00316.96
8.0.220.0030.00316.89
8.0.210.0040.00416.94
8.0.200.0050.00316.98
8.0.190.0040.00416.83
8.0.180.0100.00016.63
8.0.170.0030.00316.91
8.0.160.0000.00716.89
8.0.150.0000.00816.80
8.0.140.0020.00516.77
8.0.130.0060.00013.20
8.0.120.0040.00416.77
8.0.110.0000.00716.76
8.0.100.0050.00316.77
8.0.90.0050.00216.86
8.0.80.0100.00716.95
8.0.70.0080.00016.92
8.0.60.0000.00816.87
8.0.50.0040.00416.68
8.0.30.0100.00817.02
8.0.20.0110.00917.40
8.0.10.0040.00417.00
8.0.00.0120.00616.81
7.4.330.0030.00315.55
7.4.320.0030.00316.52
7.4.300.0030.00316.43
7.4.290.0050.00216.63
7.4.280.0000.00716.59
7.4.270.0000.00616.46
7.4.260.0000.00716.61
7.4.250.0040.00416.53
7.4.240.0000.00716.62
7.4.230.0000.00716.39
7.4.220.0110.01116.57
7.4.210.0080.00816.58
7.4.200.0000.00716.45
7.4.160.0080.01116.64
7.4.150.0130.00317.40
7.4.140.0130.00717.86
7.4.130.0080.00816.52
7.4.120.0120.00616.50
7.4.110.0120.00616.81
7.4.100.0100.00716.48
7.4.90.0060.01216.50
7.4.80.0040.01719.39
7.4.70.0090.00616.42
7.4.60.0110.00716.55
7.4.50.0070.00716.46
7.4.40.0030.01316.56
7.4.30.0130.00316.42
7.4.10.0130.00614.92
7.4.00.0090.00814.95
7.3.330.0050.00013.16
7.3.320.0000.00713.22
7.3.310.0030.00316.26
7.3.300.0060.00016.36
7.3.290.0000.00716.32
7.3.280.0050.01116.33
7.3.270.0070.01117.40
7.3.260.0120.01016.52
7.3.250.0060.01116.35
7.3.240.0120.00416.32
7.3.230.0130.01016.43
7.3.210.0160.00316.44
7.3.200.0090.01216.44
7.3.190.0070.01016.36
7.3.180.0080.00816.24
7.3.170.0070.01416.49
7.3.160.0080.00816.45
7.3.130.0070.01014.87
7.3.120.0150.00414.81
7.3.110.0060.01014.79
7.3.100.0080.00014.86
7.3.90.0100.00314.96
7.3.80.0080.00414.59
7.3.70.0000.00914.86
7.3.60.0120.00314.82
7.3.50.0070.00414.63
7.3.40.0040.00814.77
7.3.30.0070.00714.94
7.3.20.0100.00016.78
7.3.10.0050.00616.74
7.3.00.0090.00216.68
7.2.330.0100.00816.30
7.2.320.0070.01016.85
7.2.310.0100.00616.77
7.2.300.0030.01716.61
7.2.290.0120.01016.72
7.2.260.0150.00315.01
7.2.250.0090.00915.21
7.2.240.0060.00615.30
7.2.230.0090.00315.01
7.2.220.0040.01415.02
7.2.210.0030.01015.17
7.2.200.0140.00014.81
7.2.190.0060.00615.03
7.2.180.0040.01414.99
7.2.170.0060.00315.07
7.2.160.0090.00014.80
7.2.150.0070.00716.63
7.2.140.0100.00716.89
7.2.130.0060.00516.80
7.2.120.0020.01116.75
7.2.110.0050.00916.88
7.2.100.0050.00816.90
7.2.90.0050.01116.91
7.2.80.0040.01216.86
7.2.70.0090.00616.95
7.2.60.0100.00616.88
7.2.50.0090.00616.82
7.2.40.0020.01216.89
7.2.30.0070.00517.01
7.2.20.0070.00817.02
7.2.10.0050.01016.89
7.2.00.0060.00617.80
7.1.330.0110.00415.65
7.1.320.0030.01415.56
7.1.310.0080.00015.79
7.1.300.0040.00715.85
7.1.290.0060.00315.54
7.1.280.0060.00315.60
7.1.270.0060.00615.70
7.1.260.0080.00615.63
7.1.250.0020.00915.75
7.1.240.0140.00015.91
7.1.230.0040.00915.58
7.1.220.0030.00615.61
7.1.210.0040.01115.85
7.1.200.0100.00415.66
7.1.190.0030.00615.87
7.1.180.0060.00915.89
7.1.170.0040.01016.02
7.1.160.0040.01115.78
7.1.150.0030.01215.86
7.1.140.0040.01215.73
7.1.130.0060.00615.96
7.1.120.0070.00715.83
7.1.110.0060.00915.91
7.1.100.0030.01016.92
7.1.90.0000.01415.79
7.1.80.0030.01015.49
7.1.70.0100.00516.26
7.1.60.0120.01225.44
7.1.50.0120.01025.41
7.1.40.0120.01025.11
7.1.30.0100.01024.90
7.1.20.0140.00625.10
7.1.10.0070.00716.13
7.1.00.0050.00916.14
7.0.330.0070.00415.48
7.0.320.0030.00715.30
7.0.310.0070.01015.20
7.0.300.0070.00715.43
7.0.290.0030.01015.38
7.0.280.0070.01015.13
7.0.270.0100.00315.51
7.0.260.0070.00715.50
7.0.250.0100.00315.38
7.0.240.0050.00515.57
7.0.230.0000.00815.20
7.0.220.0030.00615.42
7.0.210.0080.00615.42
7.0.200.0070.00616.04
7.0.190.0080.00616.02
7.0.180.0040.00715.80
7.0.170.0000.01315.75
7.0.160.0060.00615.63
7.0.150.0040.01115.81
7.0.140.0060.01015.86
7.0.130.0040.00815.94
7.0.120.0050.01116.04
7.0.110.0090.00515.96
7.0.100.0080.00815.99
7.0.90.0080.00515.93
7.0.80.0080.00715.91
7.0.70.0080.00515.86
7.0.60.0030.01015.76
7.0.50.0010.01015.96
7.0.40.0080.00515.12
7.0.30.0090.00614.96
7.0.20.0110.00414.91
7.0.10.0040.00714.92
7.0.00.0070.00715.04
5.6.400.0000.00814.53
5.6.390.0030.01314.36
5.6.380.0050.00514.63
5.6.370.0110.00714.27
5.6.360.0110.00314.33
5.6.350.0060.00614.48
5.6.340.0070.01014.08
5.6.330.0060.00614.54
5.6.320.0100.00314.54
5.6.310.0090.00314.14
5.6.300.0090.00614.66
5.6.290.0000.01114.62
5.6.280.0060.00614.02
5.6.270.0030.01014.57
5.6.260.0060.00914.57
5.6.250.0130.00314.33
5.6.240.0060.00314.43
5.6.230.0080.00414.37
5.6.220.0070.00714.34
5.6.210.0040.01214.25
5.6.200.0030.01014.46
5.6.190.0070.00714.45
5.6.180.0030.01214.10
5.6.170.0030.01014.25
5.6.160.0070.01014.06
5.6.150.0070.00714.29
5.6.140.0060.01214.24
5.6.130.0060.00914.42
5.6.120.0090.00914.03
5.6.110.0030.01014.09
5.6.100.0030.00614.29
5.6.90.0090.00614.35
5.6.80.0000.01514.22
5.6.70.0060.00914.26
5.6.60.0090.00614.24
5.6.50.0100.00614.46
5.6.40.0040.01114.09
5.6.30.0150.00014.30
5.6.20.0040.01114.22
5.6.10.0030.01014.12
5.6.00.0030.00914.38

preferences:
43.03 ms | 401 KiB | 5 Q