3v4l.org

run code in 300+ PHP versions simultaneously
<?php // calculate sum of ordinal values of chars // starting from $start until the end of $str function charsum($str, $start) { $sum = 0; for ($i = $start, $max = strlen($str); $i < $max; ++$i) { $sum += ord($str[$i]); } return $sum; } $str = 'hello world'; echo charsum($str, strpos($str, ' ')); $x = false; echo $str[$x]; // sh/b h

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.0070.01416.63
8.3.50.0120.00622.18
8.3.40.0100.00718.96
8.3.30.0070.00719.01
8.3.20.0070.00020.39
8.3.10.0000.00823.66
8.3.00.0030.00619.81
8.2.180.0040.01816.50
8.2.170.0140.00422.96
8.2.160.0100.00320.45
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0050.00320.08
8.2.110.0060.00322.09
8.2.100.0040.00720.24
8.2.90.0040.00419.17
8.2.80.0040.00417.97
8.2.70.0090.00317.63
8.2.60.0000.00818.16
8.2.50.0000.00818.07
8.2.40.0050.00318.22
8.2.30.0040.00418.23
8.2.20.0040.00417.81
8.2.10.0070.00018.04
8.2.00.0080.00019.53
8.1.280.0070.00725.92
8.1.270.0090.00023.82
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00623.75
8.1.230.0080.00318.94
8.1.220.0040.00417.84
8.1.210.0040.00418.77
8.1.200.0060.00317.23
8.1.190.0050.00317.10
8.1.180.0060.00318.10
8.1.170.0040.00418.57
8.1.160.0040.00421.94
8.1.150.0050.00218.57
8.1.140.0000.00717.35
8.1.130.0030.00317.75
8.1.120.0000.00717.30
8.1.110.0070.00317.39
8.1.100.0050.00217.45
8.1.90.0070.00017.40
8.1.80.0040.00417.41
8.1.70.0080.00017.38
8.1.60.0060.00317.63
8.1.50.0060.00317.52
8.1.40.0050.00217.55
8.1.30.0030.00617.48
8.1.20.0040.00417.56
8.1.10.0050.00217.48
8.1.00.0050.00317.46
8.0.300.0000.00718.77
8.0.290.0000.00816.88
8.0.280.0070.00018.44
8.0.270.0000.00717.13
8.0.260.0000.00617.27
8.0.250.0040.00417.04
8.0.240.0040.00417.04
8.0.230.0040.00416.94
8.0.220.0030.00316.88
8.0.210.0020.00516.86
8.0.200.0000.00716.82
8.0.190.0040.00416.98
8.0.180.0080.00416.81
8.0.170.0040.00416.99
8.0.160.0000.00716.95
8.0.150.0030.00716.71
8.0.140.0070.00016.86
8.0.130.0040.00413.34
8.0.120.0000.00716.86
8.0.110.0000.00816.89
8.0.100.0000.00716.79
8.0.90.0030.00516.89
8.0.80.0100.00716.84
8.0.70.0040.00416.90
8.0.60.0050.00316.80
8.0.50.0050.00316.95
8.0.30.0070.01116.93
8.0.20.0100.01317.40
8.0.10.0040.00416.85
8.0.00.0110.00816.80
7.4.330.0000.00515.02
7.4.320.0000.00716.50
7.4.300.0060.00016.53
7.4.290.0030.00316.53
7.4.280.0070.00016.61
7.4.270.0000.00716.58
7.4.260.0060.00016.41
7.4.250.0000.00716.46
7.4.240.0030.00316.57
7.4.230.0000.00716.63
7.4.220.0070.01116.37
7.4.210.0100.00616.66
7.4.200.0030.00316.55
7.4.160.0060.01016.51
7.4.150.0150.00417.40
7.4.140.0050.01217.86
7.4.130.0080.00816.58
7.4.120.0120.00816.51
7.4.110.0030.01316.33
7.4.100.0070.01016.67
7.4.90.0120.00916.55
7.4.80.0040.01619.39
7.4.70.0060.00916.42
7.4.60.0090.00916.71
7.4.50.0000.00816.26
7.4.40.0080.00816.52
7.4.30.0110.00616.43
7.4.00.0030.01015.13
7.3.330.0000.00513.41
7.3.320.0070.00013.42
7.3.310.0030.00316.54
7.3.300.0000.00716.30
7.3.290.0070.00716.43
7.3.280.0060.01016.44
7.3.270.0030.01417.40
7.3.260.0130.00716.64
7.3.250.0060.01116.46
7.3.240.0130.00416.61
7.3.230.0180.00016.60
7.3.210.0090.00816.58
7.3.200.0050.01019.39
7.3.190.0120.00916.65
7.3.180.0090.00616.52
7.3.170.0100.00716.47
7.3.160.0110.01316.43
7.3.120.0070.01014.72
7.3.10.0090.00616.83
7.3.00.0130.00316.74
7.2.330.0150.00316.46
7.2.320.0100.01016.45
7.2.310.0120.00916.47
7.2.300.0130.01316.57
7.2.290.0100.00716.89
7.2.130.0060.00316.70
7.2.120.0030.00617.02
7.2.110.0000.01716.87
7.2.100.0090.00616.96
7.2.90.0090.00316.88
7.2.80.0000.01017.05
7.2.70.0070.00416.99
7.2.60.0060.00617.12
7.2.50.0100.00617.02
7.2.40.0070.01117.04
7.2.30.0080.00416.89
7.2.20.0030.01017.02
7.2.10.0030.00916.74
7.2.00.0060.00917.12
7.1.250.0030.01015.84
7.1.240.0030.00615.70
7.1.230.0140.00015.70
7.1.220.0140.00015.75
7.1.210.0040.01115.86
7.1.200.0040.00915.60
7.1.190.0080.00615.97
7.1.180.0060.00615.81
7.1.170.0130.00015.96
7.1.160.0100.00315.82
7.1.150.0040.00815.70
7.1.140.0040.01115.84
7.1.130.0060.00915.63
7.1.120.0060.00615.58
7.1.110.0070.00715.96
7.1.100.0070.00715.59
7.1.90.0080.00315.93
7.1.80.0040.00415.53
7.1.70.0070.00616.51
7.1.60.0090.00917.74
7.1.50.0050.01316.32
7.1.40.0070.00715.89
7.1.30.0060.00315.84
7.1.20.0100.00315.94
7.1.10.0000.01115.85
7.1.00.0020.04519.14
7.0.330.0030.01015.63
7.0.320.0060.00615.25
7.0.310.0060.00615.36
7.0.300.0100.00315.41
7.0.290.0030.00615.34
7.0.280.0120.00015.37
7.0.270.0120.00015.36
7.0.260.0090.00615.06
7.0.250.0000.01015.39
7.0.240.0070.00315.35
7.0.230.0090.00315.39
7.0.220.0080.00415.57
7.0.210.0100.00315.55
7.0.200.0090.00616.18
7.0.190.0090.00015.53
7.0.180.0030.01015.45
7.0.170.0090.00615.53
7.0.160.0040.00815.59
7.0.150.0090.00315.45
7.0.140.0030.04118.80
7.0.130.0000.01015.38
7.0.120.0030.00915.36
7.0.110.0030.01015.41
7.0.100.0070.00315.42
7.0.90.0030.01015.43
7.0.80.0030.00515.46
7.0.70.0050.00515.35
7.0.60.0050.03617.73
7.0.50.0080.03516.65
7.0.40.0030.02716.95
7.0.30.0150.03816.71
7.0.20.0170.02516.73
7.0.10.0110.04016.78
7.0.00.0070.02616.80
5.6.380.0030.01014.59
5.6.370.0090.00614.33
5.6.360.0120.00314.30
5.6.350.0090.00614.45
5.6.340.0070.00314.27
5.6.330.0070.00314.26
5.6.320.0090.00314.27
5.6.310.0000.00814.73
5.6.300.0000.01614.61
5.6.290.0040.00414.68
5.6.280.0050.04117.69
5.6.270.0040.00414.43
5.6.260.0060.00614.25
5.6.250.0080.00414.38
5.6.240.0090.00614.48
5.6.230.0100.00314.48
5.6.220.0040.00414.59
5.6.210.0060.04617.41
5.6.200.0050.02216.31
5.6.190.0120.02017.51
5.6.180.0120.04717.54
5.6.170.0130.04317.45
5.6.160.0080.02217.46
5.6.150.0020.02816.29
5.6.140.0090.02516.33
5.6.130.0110.02316.33
5.6.120.0100.02517.63
5.6.110.0080.04217.63
5.6.100.0080.03717.66
5.6.90.0060.04817.69
5.6.80.0030.03517.23
5.6.70.0000.01414.46
5.6.60.0060.00314.45
5.6.50.0120.00314.40
5.6.40.0030.00614.54
5.6.30.0030.01014.11
5.6.20.0060.00614.46
5.6.10.0070.00714.46
5.6.00.0000.01314.22
5.5.380.0040.00811.52
5.5.370.0050.00211.50
5.5.360.0060.00611.42
5.5.350.0050.02215.82
5.5.340.0070.02914.54
5.5.330.0000.02915.79
5.5.320.0080.03915.91
5.5.310.0130.03315.72
5.5.300.0060.03814.71
5.5.290.0090.04314.69
5.5.280.0100.03915.93
5.5.270.0090.04415.84
5.5.260.0050.04615.91
5.5.250.0030.03215.82
5.5.240.0120.02315.77
5.5.230.0000.00911.14
5.5.220.0000.00711.27
5.5.210.0000.00811.27
5.5.200.0050.00511.21
5.5.190.0030.01010.88
5.5.180.0040.00711.07
5.5.170.0040.00811.24
5.5.160.0060.00011.27
5.5.150.0000.00611.27
5.5.140.0040.00410.89
5.5.130.0070.00410.91
5.5.120.0030.00711.12
5.5.110.0030.00611.50
5.5.100.0060.00311.35
5.5.90.0030.00611.04
5.5.80.0040.00411.38
5.5.70.0070.00711.48
5.5.60.0030.00611.08
5.5.50.0040.00411.27
5.5.40.0000.01011.25
5.5.30.0000.01111.15
5.5.20.0060.00310.94
5.5.10.0060.00611.32
5.5.00.0000.01311.29
5.4.450.0190.04215.24
5.4.440.0450.03615.14
5.4.430.0470.03615.34
5.4.420.0550.02615.38
5.4.410.0510.02715.29
5.4.400.0450.02815.16
5.4.390.0420.03815.06
5.4.380.0130.02814.76
5.4.370.0080.03014.86
5.4.360.0130.02814.90
5.4.350.0220.02314.95
5.4.340.0210.02114.87
5.4.330.0030.00610.88
5.4.320.0040.02511.86
5.4.310.0040.02911.89
5.4.300.0040.02111.78
5.4.290.0050.02011.89
5.4.280.0040.02111.76
5.4.270.0050.02111.76
5.4.260.0020.02311.86
5.4.250.0050.02211.78
5.4.240.0050.02311.51
5.4.230.0050.02411.85
5.4.220.0040.02011.83
5.4.210.0060.02011.88
5.4.200.0040.02111.59
5.4.190.0020.02211.61
5.4.180.0030.02411.71
5.4.170.0050.02111.56
5.4.160.0070.01811.77
5.4.150.0060.02311.78
5.4.140.0050.02111.60
5.4.130.0060.02011.38
5.4.120.0020.02411.46
5.4.110.0060.02411.58
5.4.100.0050.02311.60
5.4.90.0070.01911.55
5.4.80.0060.02211.64
5.4.70.0020.02111.69
5.4.60.0030.02111.41
5.4.50.0060.02111.65
5.4.40.0050.02011.60
5.4.30.0060.02111.61
5.4.20.0040.02411.53
5.4.10.0050.01811.54
5.4.00.0040.02011.35
5.3.290.0080.04311.76
5.3.280.0060.02211.66
5.3.270.0040.02211.71
5.3.260.0050.02211.71
5.3.250.0050.02111.69
5.3.240.0020.02411.61
5.3.230.0020.02411.55
5.3.220.0050.02211.52
5.3.210.0050.02111.43
5.3.200.0050.02211.60
5.3.190.0020.02211.60
5.3.180.0050.02011.67
5.3.170.0070.02011.63
5.3.160.0040.02011.71
5.3.150.0050.02511.61
5.3.140.0060.02211.65
5.3.130.0020.02311.63
5.3.120.0020.02511.68
5.3.110.0040.02511.60
5.3.100.0070.01911.33
5.3.90.0060.02011.41
5.3.80.0070.02011.20
5.3.70.0070.01811.25
5.3.60.0040.02211.34
5.3.50.0050.02111.27
5.3.40.0050.02211.22
5.3.30.0080.01811.37
5.3.20.0040.02211.16
5.3.10.0020.02111.04
5.3.00.0030.02410.87
5.2.170.0040.0169.41
5.2.160.0020.0199.43
5.2.150.0040.0189.40
5.2.140.0070.0159.37
5.2.130.0030.0189.25
5.2.120.0060.0169.43
5.2.110.0020.0199.36
5.2.100.0060.0159.22
5.2.90.0060.0189.36
5.2.80.0050.0169.31
5.2.70.0050.0189.15
5.2.60.0040.0189.29
5.2.50.0050.0179.27
5.2.40.0040.0219.13
5.2.30.0040.0179.23
5.2.20.0070.0159.21
5.2.10.0020.0179.11
5.2.00.0040.0168.98
5.1.60.0040.0148.30
5.1.50.0030.0138.33
5.1.40.0020.0168.35
5.1.30.0010.0188.59
5.1.20.0040.0168.40
5.1.10.0060.0128.43
5.1.00.0050.0138.24
5.0.50.0010.0147.17
5.0.40.0020.0137.10
5.0.30.0020.0197.01
5.0.20.0020.0126.99
5.0.10.0050.0096.98
5.0.00.0010.0206.97
4.4.90.0020.0106.24
4.4.80.0020.0106.23
4.4.70.0040.0096.22
4.4.60.0030.0096.22
4.4.50.0030.0096.23
4.4.40.0020.0156.20
4.4.30.0020.0116.23
4.4.20.0020.0096.27
4.4.10.0020.0096.27
4.4.00.0040.0136.23
4.3.110.0020.0126.18
4.3.100.0020.0096.18
4.3.90.0030.0096.16
4.3.80.0030.0166.14
4.3.70.0020.0096.16
4.3.60.0000.0106.16
4.3.50.0020.0106.16
4.3.40.0010.0166.12
4.3.30.0010.0105.50
4.3.20.0000.0135.49
4.3.10.0020.0085.47
4.3.00.0050.01611.93

preferences:
45 ms | 401 KiB | 5 Q