3v4l.org

run code in 300+ PHP versions simultaneously
<?php // https://github.com/sugarcrm/sugarcrm_dev/blob/ae189cfa4ed4edd6a4e1e0d9d1d5ec66f46a0b74/include/utils.php#L2082-L2090 function str_begin($str, $begin) { return (substr($str, 0, strlen($begin)) == $begin); } function str_end($str, $end) { return (substr($str, strlen($str) - strlen($end)) == $end); } // Let's test edge cases $funcs = array( 'str_begin', 'str_end', ); $tests = array( // array(array($main, $part), $expected) array(array("foo", "foo"), true), array(array("foo", ""), true), array(array("", "foo"), false), array(array("", ""), true), ); foreach ($funcs as $func) { foreach ($tests as $test) { list($args, $expected) = $test; list($main, $part) = $args; echo $func . '("' . $main . '", "' . $part . '"):' . PHP_EOL; echo " - Expected: "; var_dump($expected); echo " - Actual: "; var_dump($func($main, $part)); echo PHP_EOL; } echo PHP_EOL; }

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.0040.01118.43
8.3.50.0150.00016.50
8.3.40.0110.00318.73
8.3.30.0040.01218.67
8.3.20.0050.00320.31
8.3.10.0040.00423.74
8.3.00.0080.00019.79
8.2.180.0150.00618.16
8.2.170.0120.00622.96
8.2.160.0040.01119.10
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0070.00319.30
8.2.120.0040.00426.35
8.2.110.0030.00620.44
8.2.100.0090.00317.91
8.2.90.0000.00819.36
8.2.80.0030.00518.02
8.2.70.0030.00717.50
8.2.60.0040.00418.04
8.2.50.0030.00518.10
8.2.40.0030.00620.50
8.2.30.0040.00419.26
8.2.20.0050.00218.06
8.2.10.0040.00418.06
8.2.00.0000.00718.21
8.1.280.0180.00025.92
8.1.270.0000.00822.10
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0070.00320.91
8.1.230.0090.00318.95
8.1.220.0060.00317.76
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0090.00017.10
8.1.180.0040.00418.10
8.1.170.0000.00818.59
8.1.160.0070.00019.00
8.1.150.0040.00420.67
8.1.140.0000.00719.61
8.1.130.0080.00018.88
8.1.120.0000.00817.40
8.1.110.0040.00717.50
8.1.100.0000.00717.48
8.1.90.0080.00017.53
8.1.80.0060.00317.39
8.1.70.0000.01017.48
8.1.60.0080.00017.66
8.1.50.0030.00517.57
8.1.40.0000.01017.54
8.1.30.0000.00817.60
8.1.20.0000.00817.63
8.1.10.0040.00417.64
8.1.00.0060.00317.53
8.0.300.0040.00418.77
8.0.290.0080.00016.75
8.0.280.0000.00718.49
8.0.270.0030.00317.21
8.0.260.0000.00716.91
8.0.250.0050.00317.05
8.0.240.0040.00417.04
8.0.230.0030.00316.88
8.0.220.0000.00716.84
8.0.210.0080.00017.02
8.0.200.0030.00516.97
8.0.190.0030.00617.02
8.0.180.0040.00416.87
8.0.170.0000.00816.86
8.0.160.0050.00316.99
8.0.150.0030.00316.90
8.0.140.0030.00316.78
8.0.130.0030.00313.34
8.0.120.0000.00816.89
8.0.110.0050.00216.82
8.0.100.0040.00416.96
8.0.90.0040.00416.81
8.0.80.0090.00616.88
8.0.70.0000.00816.74
8.0.60.0000.00716.79
8.0.50.0040.00416.77
8.0.30.0100.01117.15
8.0.20.0110.00917.40
8.0.10.0070.00016.98
8.0.00.0090.00917.00
7.4.330.0030.00315.55
7.4.320.0000.00616.64
7.4.300.0000.00616.48
7.4.290.0060.00316.43
7.4.280.0030.00616.60
7.4.270.0070.00016.46
7.4.260.0050.00416.52
7.4.250.0030.00516.59
7.4.240.0000.00716.49
7.4.230.0070.00016.70
7.4.220.0130.00716.66
7.4.210.0060.00916.61
7.4.200.0050.00316.64
7.4.160.0030.01416.52
7.4.150.0060.01817.40
7.4.140.0110.01017.86
7.4.130.0110.01116.66
7.4.120.0160.00716.65
7.4.110.0070.01016.51
7.4.100.0150.00316.71
7.4.90.0160.00316.61
7.4.80.0030.01319.39
7.4.70.0130.00316.57
7.4.60.0060.01016.66
7.4.50.0120.00316.57
7.4.40.0050.01116.53
7.4.30.0200.01716.59
7.4.00.0060.00914.74
7.3.330.0000.00513.25
7.3.320.0080.00013.41
7.3.310.0000.00716.27
7.3.300.0030.00516.44
7.3.290.0080.00616.43
7.3.280.0100.00716.38
7.3.270.0040.01417.40
7.3.260.0130.00616.44
7.3.250.0080.01016.40
7.3.240.0110.00816.44
7.3.230.0160.00716.60
7.3.210.0070.01316.45
7.3.200.0060.01116.41
7.3.190.0110.01116.50
7.3.180.0070.01016.45
7.3.170.0100.00616.29
7.3.160.0090.00616.69
7.3.00.0170.00016.66
7.2.330.0110.00816.61
7.2.320.0110.00816.62
7.2.310.0080.00916.39
7.2.300.0100.00716.77
7.2.290.0070.01016.70
7.2.130.0070.00716.57
7.2.120.0070.00316.87
7.2.110.0000.01217.05
7.2.100.0140.00316.82
7.2.90.0030.01316.85
7.2.80.0100.00716.86
7.2.70.0070.01017.02
7.2.60.0100.00416.89
7.2.50.0090.00416.93
7.2.40.0060.00916.91
7.2.30.0040.01117.02
7.2.20.0070.01016.56
7.2.10.0080.00316.71
7.2.00.0150.00817.95
7.1.250.0120.00615.58
7.1.240.0090.00615.71
7.1.230.0100.00315.64
7.1.220.0070.00715.55
7.1.210.0090.00615.60
7.1.200.0040.01015.88
7.1.190.0070.01015.84
7.1.180.0000.01115.45
7.1.170.0110.00615.68
7.1.160.0000.01115.77
7.1.150.0160.00015.67
7.1.140.0060.00915.55
7.1.130.0100.00715.85
7.1.120.0040.01115.41
7.1.110.0100.00615.61
7.1.100.0030.01016.81
7.1.90.0000.01015.73
7.1.80.0070.00715.80
7.1.70.0080.00816.51
7.1.60.0570.00824.45
7.1.50.0260.00525.28
7.1.40.0350.01324.20
7.1.30.0400.01024.26
7.1.20.0230.00925.07
7.1.10.0070.01015.98
7.1.00.0290.01215.30
7.0.330.0090.00615.45
7.0.320.0120.00315.34
7.0.310.0160.00415.25
7.0.300.0060.00915.32
7.0.290.0060.00615.22
7.0.280.0030.00915.29
7.0.270.0090.00615.13
7.0.260.0040.01115.24
7.0.250.0000.00915.40
7.0.240.0070.01015.34
7.0.230.0060.00615.14
7.0.220.0060.01015.34
7.0.210.0060.00915.25
7.0.200.0310.00816.11
7.0.190.0290.00715.28
7.0.180.0110.00715.79
7.0.170.0240.01315.97
7.0.160.0060.00915.76
7.0.150.0060.01115.86
7.0.140.0080.00815.69
7.0.130.0260.01015.04
7.0.120.0240.01114.92
7.0.110.0150.00815.78
7.0.100.0200.01315.93
7.0.90.0220.01014.80
7.0.80.0260.00614.98
7.0.70.0250.00814.81
7.0.60.0080.01115.79
7.0.50.0270.00614.87
7.0.40.0100.00714.99
7.0.30.0280.00514.05
7.0.20.0080.00614.83
7.0.10.0040.01315.00
7.0.00.0140.01114.01
5.6.380.0090.00613.99

preferences:
50.57 ms | 401 KiB | 5 Q