3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo1($string, $with) { if (!$bytes = strlen($with)) { return true; } // Warning check, see http://php.net/manual/en/function.substr-compare.php#refsect1-function.substr-compare-returnvalues if (strlen($string) < $bytes) { return false; } return substr_compare($string, $with, -$bytes); } function foo2($string, $with) { if (!$bytes = strlen($with)) { return true; } // Warning check, see http://php.net/manual/en/function.substr-compare.php#refsect1-function.substr-compare-returnvalues if (strlen($string) < $bytes) { return false; } return substr_compare($string, $with, -$bytes, $bytes); } var_dump(foo1('a', 'a')); var_dump(foo2('a', 'a')); var_dump(foo1('', '')); var_dump(foo2('', '')); var_dump(foo1('a', '')); var_dump(foo2('a', '')); var_dump(foo1('', 'a')); var_dump(foo2('', 'a'));

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.40.0100.00618.56
8.3.30.0070.00719.14
8.3.20.0000.00820.21
8.3.10.0030.00620.38
8.3.00.0150.00419.25
8.2.170.0110.00422.96
8.2.160.0040.01120.52
8.2.150.0030.00624.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0000.00722.14
8.2.110.0100.00620.52
8.2.100.0000.01118.16
8.2.90.0030.00619.05
8.2.80.0050.00317.97
8.2.70.0050.00317.75
8.2.60.0060.00317.68
8.2.50.0030.00918.07
8.2.40.0030.00518.09
8.2.30.0040.00418.14
8.2.20.0030.00517.76
8.2.10.0050.00318.14
8.2.00.0080.00017.65
8.1.270.0050.00323.97
8.1.260.0040.00426.35
8.1.250.0000.00928.09
8.1.240.0130.00723.89
8.1.230.0080.00319.04
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0030.00617.22
8.1.190.0030.00617.10
8.1.180.0000.00818.10
8.1.170.0060.00318.65
8.1.160.0050.00322.03
8.1.150.0000.00718.84
8.1.140.0030.00617.41
8.1.130.0040.00417.82
8.1.120.0050.00317.47
8.1.110.0040.00717.49
8.1.100.0070.00017.47
8.1.90.0000.00817.52
8.1.80.0040.00417.39
8.1.70.0040.00417.47
8.1.60.0090.00017.51
8.1.50.0030.00517.54
8.1.40.0000.00817.44
8.1.30.0050.00517.69
8.1.20.0050.00217.69
8.1.10.0000.00917.42
8.1.00.0040.00417.44
8.0.300.0030.00518.77
8.0.290.0000.00816.75
8.0.280.0000.00718.46
8.0.270.0030.00317.14
8.0.260.0000.00817.17
8.0.250.0000.00616.94
8.0.240.0000.00616.88
8.0.230.0000.00716.85
8.0.220.0000.00716.91
8.0.210.0000.00816.82
8.0.200.0000.00616.83
8.0.190.0000.01016.88
8.0.180.0040.00416.95
8.0.170.0040.00416.85
8.0.160.0050.00316.94
8.0.150.0000.00716.93
8.0.140.0070.00016.88
8.0.130.0000.00513.37
8.0.120.0040.00416.96
8.0.110.0050.00216.93
8.0.100.0070.00016.85
8.0.90.0040.00416.78
8.0.80.0110.00416.88
8.0.70.0040.00416.86
8.0.60.0040.00416.80
8.0.50.0080.00016.80
8.0.30.0100.01017.32
8.0.20.0100.00917.40
8.0.10.0080.00017.03
8.0.00.0150.00716.87
7.4.330.0050.00015.07
7.4.320.0030.00316.57
7.4.300.0000.00616.55
7.4.290.0030.00316.45
7.4.280.0000.00816.52
7.4.270.0070.00016.48
7.4.260.0030.00316.44
7.4.250.0000.00716.38
7.4.240.0050.00316.54
7.4.230.0040.00416.55
7.4.220.0110.00716.41
7.4.210.0200.00016.51
7.4.200.0040.00416.68
7.4.160.0120.00316.38
7.4.150.0120.00617.40
7.4.140.0060.01417.86
7.4.130.0120.00516.55
7.4.120.0100.00716.52
7.4.110.0060.01216.61
7.4.100.0100.00716.47
7.4.90.0140.00316.39
7.4.80.0110.01019.39
7.4.70.0100.00816.54
7.4.60.0060.01016.57
7.4.50.0000.00816.44
7.4.40.0070.01016.36
7.4.30.0160.00316.51
7.4.10.0160.00314.88
7.4.00.0040.01315.04
7.3.330.0000.00513.35
7.3.320.0050.00013.24
7.3.310.0070.00016.39
7.3.300.0030.00316.30
7.3.290.0060.00916.35
7.3.280.0110.00616.37
7.3.270.0120.00617.40
7.3.260.0030.01416.36
7.3.250.0120.00816.60
7.3.240.0030.01416.61
7.3.230.0040.01216.39
7.3.210.0060.01216.39
7.3.200.0080.01619.39
7.3.190.0110.00716.52
7.3.180.0060.01016.41
7.3.170.0120.00616.62
7.3.160.0090.00816.61
7.3.130.0060.01214.52
7.3.120.0060.01214.57
7.3.110.0110.00714.63
7.3.100.0000.01214.87
7.3.90.0090.00014.66
7.3.80.0080.00414.81
7.3.70.0090.00614.70
7.3.60.0070.00714.86
7.3.50.0080.01114.82
7.3.40.0000.01014.84
7.3.30.0080.00815.00
7.3.20.0030.00616.72
7.3.10.0060.00916.50
7.3.00.0100.00416.59
7.2.330.0030.01416.60
7.2.320.0180.00316.50
7.2.310.0060.01516.59
7.2.300.0090.00616.77
7.2.290.0060.01116.70
7.2.260.0170.00015.07
7.2.250.0070.01115.17
7.2.240.0070.00715.00
7.2.230.0070.01414.94
7.2.220.0030.01015.03
7.2.210.0060.00615.20
7.2.200.0050.00515.03
7.2.190.0100.00714.85
7.2.180.0030.00715.11
7.2.170.0100.00714.90
7.2.160.0090.00615.02
7.2.150.0060.00616.85
7.2.140.0040.01116.81
7.2.130.0030.00916.92
7.2.120.0090.00416.89
7.2.110.0070.00416.76
7.2.100.0130.00416.82
7.2.90.0120.00616.83
7.2.80.0050.01016.87
7.2.70.0090.00616.93
7.2.60.0070.00716.70
7.2.50.0070.00916.79
7.2.40.0070.00816.87
7.2.30.0090.00616.85
7.2.20.0030.01216.72
7.2.10.0090.01016.87
7.2.00.0060.00717.54
7.1.330.0060.00615.84
7.1.320.0120.00316.05
7.1.310.0070.00415.97
7.1.300.0040.01515.91
7.1.290.0030.00715.82
7.1.280.0070.00415.78
7.1.270.0100.00315.70
7.1.260.0040.01115.61
7.1.250.0090.00315.86
7.1.240.0040.01115.68
7.1.230.0090.00415.74
7.1.220.0070.00915.61
7.1.210.0080.00515.79
7.1.200.0080.00815.82
7.1.190.0080.00815.83
7.1.180.0080.00815.77
7.1.170.0030.01015.73
7.1.160.0100.00315.83
7.1.150.0040.00715.79
7.1.140.0080.00715.74
7.1.130.0030.01215.71
7.1.120.0080.00615.71
7.1.110.0060.01015.97
7.1.100.0070.00516.59
7.1.90.0020.01215.74
7.1.80.0060.00915.91
7.1.70.0040.00616.17
7.1.60.0080.00617.02
7.1.50.0090.01022.13
7.1.40.0060.00315.74
7.1.30.0020.01115.69
7.1.20.0040.00615.88
7.1.10.0150.00215.76
7.1.00.0070.02717.95
7.0.330.0020.01315.42
7.0.320.0020.01015.19
7.0.310.0090.00615.24
7.0.300.0050.01215.20
7.0.290.0030.00615.43
7.0.280.0040.00915.34
7.0.270.0060.00815.22
7.0.260.0040.00915.37
7.0.250.0050.01115.30
7.0.240.0050.00815.43
7.0.230.0060.00815.41
7.0.220.0090.00615.38
7.0.210.0110.00515.46
7.0.200.0050.00615.89
7.0.190.0050.00315.47
7.0.180.0060.00715.32
7.0.170.0080.00615.48
7.0.160.0020.01315.38
7.0.150.0120.00215.45
7.0.140.0030.03217.63
7.0.130.0030.00815.40
7.0.120.0030.00815.30
7.0.110.0030.00915.36
7.0.100.0040.01015.38
7.0.90.0100.00515.37
7.0.80.0050.00815.39
7.0.70.0050.00615.21
7.0.60.0050.02016.88
7.0.50.0080.02216.29
7.0.40.0080.03215.74
7.0.30.0100.02215.60
7.0.20.0140.03115.63
7.0.10.0070.03215.67
7.0.00.0060.01815.74
5.6.400.0090.00314.34
5.6.390.0040.01114.05
5.6.380.0050.00814.40
5.6.370.0070.01014.29
5.6.360.0050.00614.13
5.6.350.0080.00714.04
5.6.340.0060.00614.40
5.6.330.0060.00414.16
5.6.320.0100.00514.23
5.6.310.0030.01314.14
5.6.300.0080.00614.34
5.6.290.0070.00714.26
5.6.280.0080.02816.48
5.6.270.0010.01314.27
5.6.260.0080.00514.29
5.6.250.0090.00514.27
5.6.240.0070.00714.39
5.6.230.0050.00414.19
5.6.220.0020.01214.31
5.6.210.0060.01916.36
5.6.200.0040.01915.70
5.6.190.0060.02516.26
5.6.180.0170.02216.37
5.6.170.0140.03016.30
5.6.160.0000.02316.25
5.6.150.0070.03115.58
5.6.140.0100.03015.55
5.6.130.0100.02915.56
5.6.120.0080.02016.50
5.6.110.0050.02116.52
5.6.100.0040.02116.54
5.6.90.0070.01816.59
5.6.80.0040.03516.19
5.6.70.0070.00414.16
5.6.60.0020.01014.35
5.6.50.0090.00514.17
5.6.40.0120.00214.12
5.6.30.0030.01314.03
5.6.20.0050.00914.10
5.6.10.0010.00714.14
5.6.00.0090.00614.08
5.5.380.0040.00812.61
5.5.370.0050.00512.61
5.5.360.0050.00512.74
5.5.350.0090.03115.18
5.5.340.0060.01914.41
5.5.330.0070.03115.23
5.5.320.0150.02215.01
5.5.310.0110.03115.27
5.5.300.0060.02014.24
5.5.290.0050.02214.42
5.5.280.0010.02215.20
5.5.270.0040.02115.35
5.5.260.0060.02615.31
5.5.250.0080.01715.27
5.5.240.0090.02915.03
5.5.230.0060.00712.62
5.5.220.0020.01412.71
5.5.210.0060.00512.35
5.5.200.0030.00812.55
5.5.190.0020.00912.60
5.5.180.0060.00712.61
5.5.170.0040.00712.49
5.5.160.0060.00312.57
5.5.150.0040.00912.51
5.5.140.0050.01012.67
5.5.130.0060.00812.63
5.5.120.0050.00812.47
5.5.110.0060.00512.51
5.5.100.0040.00612.55
5.5.90.0050.00512.52
5.5.80.0060.00512.34
5.5.70.0070.00512.56
5.5.60.0020.00812.52
5.5.50.0020.01212.71
5.5.40.0070.00412.51
5.5.30.0040.00512.55
5.5.20.0050.00312.31
5.5.10.0050.00812.60
5.5.00.0050.00712.51
5.4.450.0460.02014.53
5.4.440.0330.02514.45
5.4.430.0340.02314.40
5.4.420.0290.00514.47
5.4.410.0280.00414.49
5.4.400.0240.00414.40
5.4.390.0210.00714.44
5.4.380.0260.00414.40
5.4.370.0240.00414.47
5.4.360.0230.00314.35
5.4.350.0230.00514.45
5.4.340.0220.00514.35
5.4.330.0040.00612.03
5.4.320.0060.01712.07
5.4.310.0080.01512.19
5.4.300.0050.01812.14
5.4.290.0070.01912.15
5.4.280.0070.01412.17
5.4.270.0080.01812.08
5.4.260.0050.01712.14
5.4.250.0040.01812.16
5.4.240.0030.01712.19
5.4.230.0040.01712.09
5.4.220.0040.01712.05
5.4.210.0040.01512.16
5.4.200.0050.01512.05
5.4.190.0040.01912.00
5.4.180.0060.01512.09
5.4.170.0060.01712.02
5.4.160.0060.01512.16
5.4.150.0060.01412.17
5.4.140.0030.01912.04
5.4.130.0080.01612.05
5.4.120.0080.01912.03
5.4.110.0080.01411.92
5.4.100.0050.01611.96
5.4.90.0070.01311.93
5.4.80.0030.01812.01
5.4.70.0040.01511.93
5.4.60.0050.01811.98
5.4.50.0070.01512.05
5.4.40.0020.02011.95
5.4.30.0030.02011.99
5.4.20.0040.01512.04
5.4.10.0010.01811.96
5.4.00.0060.01411.88
5.3.290.0100.01811.75
5.3.280.0060.02111.65
5.3.270.0060.02511.52
5.3.260.0060.02611.68
5.3.250.0070.02511.68
5.3.240.0080.02011.62
5.3.230.0030.02611.64
5.3.220.0060.02011.55
5.3.210.0040.02411.56
5.3.200.0070.01811.54
5.3.190.0020.02411.62
5.3.180.0050.02211.54
5.3.170.0060.02111.53
5.3.160.0040.02011.65
5.3.150.0060.02011.56
5.3.140.0060.01911.53
5.3.130.0060.02111.61
5.3.120.0050.02211.54
5.3.110.0010.02511.62
5.3.100.0060.02111.33
5.3.90.0020.02711.42
5.3.80.0080.01911.18
5.3.70.0080.01811.29
5.3.60.0090.02411.19
5.3.50.0050.02111.20
5.3.40.0050.02211.25
5.3.30.0090.01811.34
5.3.20.0060.02111.17
5.3.10.0060.02111.02
5.3.00.0070.02311.04
5.2.170.0020.0209.41
5.2.160.0030.0179.34
5.2.150.0070.0199.43
5.2.140.0040.0199.42
5.2.130.0040.0169.20
5.2.120.0040.0179.23
5.2.110.0050.0189.22
5.2.100.0080.0149.40
5.2.90.0030.0179.30
5.2.80.0050.0209.26
5.2.70.0040.0189.29
5.2.60.0050.0179.24
5.2.50.0040.0219.26
5.2.40.0050.0209.27
5.2.30.0040.0229.21
5.2.20.0020.0179.21
5.2.10.0040.0168.93
5.2.00.0040.0198.95
5.1.60.0030.0158.23
5.1.50.0050.0138.30
5.1.40.0060.0128.31
5.1.30.0050.0168.61
5.1.20.0040.0158.51
5.1.10.0060.0138.41
5.1.00.0060.0138.33
5.0.50.0040.0127.36
5.0.40.0020.0117.29
5.0.30.0060.0157.19
5.0.20.0030.0127.18
5.0.10.0070.0097.17
5.0.00.0040.0187.17
4.4.90.0050.0086.42
4.4.80.0040.0086.41
4.4.70.0020.0106.41
4.4.60.0020.0116.41
4.4.50.0020.0116.42
4.4.40.0040.0156.39
4.4.30.0020.0096.41
4.4.20.0020.0106.46
4.4.10.0030.0086.46
4.4.00.0030.0146.41
4.3.110.0020.0106.37
4.3.100.0020.0116.37
4.3.90.0010.0136.35
4.3.80.0020.0156.33
4.3.70.0020.0106.35
4.3.60.0040.0086.35
4.3.50.0010.0126.35
4.3.40.0030.0146.30
4.3.30.0010.0115.69
4.3.20.0020.0105.68
4.3.10.0030.0075.66
4.3.00.0000.01312.29

preferences:
64.56 ms | 400 KiB | 5 Q