3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!function_exists('str_contains')) { function str_contains(string $haystack, string $needle): bool { return '' === $needle || false !== strpos($haystack, $needle); } } if (!function_exists('str_ends_with')) { function str_ends_with(string $haystack, string $needle): bool { return '' === $needle || ('' !== $haystack && 0 === \substr_compare($haystack, $needle, -\strlen($needle))); } } if (!function_exists('str_starts_with')) { function str_starts_with(string $haystack, string $needle): bool { return 0 === \strncmp($haystack, $needle, \strlen($needle)); } } $methods = [ 'str_contains', 'str_starts_with', 'str_ends_with', ]; $types = [ 'string' => 'test', 'int' => 1, 'float' => 1.23, 'null' => null, 'true' => true, 'false' => false, 'object' => new StdClass(), 'array' => [], ]; $result = []; foreach ($methods as $method) { foreach ($types as $type => $val) { foreach (['first' => [$val, 'test'], 'second' => ['test', $val]] as $firstSecond => $args) { try { $res = $method(...$args); } catch (Error $e) { $res = 'Fatal error triggered'; } $result[$method][$type][$firstSecond] = $res; } } } var_export($result);

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.80.0090.00416.88
8.3.70.0130.00616.87
8.3.60.0040.01516.75
8.3.50.0100.01018.13
8.3.40.0100.01018.91
8.3.30.0100.01019.00
8.3.20.0030.00524.18
8.3.10.0120.00324.66
8.3.00.0000.00826.16
8.2.200.0030.00616.50
8.2.190.0060.01216.75
8.2.180.0110.00425.92
8.2.170.0150.00619.04
8.2.160.0070.00722.96
8.2.150.0000.01125.66
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0070.00026.35
8.2.110.0090.00021.04
8.2.100.0040.00817.91
8.2.90.0080.00018.09
8.2.80.0060.00319.13
8.2.70.0000.00917.88
8.2.60.0040.00418.05
8.2.50.0040.00418.07
8.2.40.0000.00818.34
8.2.30.0060.00318.16
8.2.20.0040.00418.02
8.2.10.0030.00519.25
8.2.00.0030.00519.37
8.1.290.0030.00630.84
8.1.280.0120.00925.92
8.1.270.0060.00324.02
8.1.260.0060.00328.09
8.1.250.0080.00028.09
8.1.240.0100.00023.91
8.1.230.0080.00321.02
8.1.220.0090.00017.74
8.1.210.0030.00618.77
8.1.200.0060.00317.38
8.1.190.0030.00517.35
8.1.180.0080.00018.10
8.1.170.0040.00418.55
8.1.160.0080.00018.90
8.1.150.0040.00418.79
8.1.140.0050.00518.91
8.1.130.0030.00320.15
8.1.120.0040.00417.51
8.1.110.0050.00317.37
8.1.100.0040.00417.48
8.1.90.0040.00417.48
8.1.80.0030.00417.45
8.1.70.0000.00717.41
8.1.60.0040.00417.59
8.1.50.0060.00317.51
8.1.40.0000.00717.47
8.1.30.0080.00017.69
8.1.20.0060.00317.66
8.1.10.0050.00317.58
8.1.00.0050.00317.61
8.0.300.0000.00719.90
8.0.290.0040.00416.75
8.0.280.0000.00820.14
8.0.270.0000.00818.05
8.0.260.0000.00720.30
8.0.250.0040.00417.08
8.0.240.0000.00717.05
8.0.230.0000.00817.07
8.0.220.0030.00317.00
8.0.210.0040.00416.88
8.0.200.0030.00316.93
8.0.190.0080.00017.05
8.0.180.0050.00216.91
8.0.170.0090.00016.89
8.0.160.0040.00416.96
8.0.150.0000.00916.93
8.0.140.0000.00816.87
8.0.130.0000.00513.45
8.0.120.0000.00916.99
8.0.110.0070.00016.84
8.0.100.0040.00416.78
8.0.90.0000.00717.02
8.0.80.0070.00716.94
8.0.70.0030.00517.03
8.0.60.0000.00716.90
8.0.50.0000.00717.00
8.0.30.0060.01017.22
8.0.20.0120.01217.15
8.0.10.0020.00517.00
8.0.00.0180.00316.73
7.4.330.0000.00515.55
7.4.320.0000.00616.46
7.4.300.0000.00616.62
7.4.290.0040.00416.61
7.4.280.0000.00816.63
7.4.270.0000.00816.63
7.4.260.0050.00013.32
7.4.250.0040.00416.51
7.4.240.0000.00716.68
7.4.230.0000.00716.42
7.4.220.0060.00116.71
7.4.210.0050.01016.53
7.4.200.0030.00316.70
7.4.130.0080.01216.51
7.4.120.0140.00916.61
7.4.110.0030.01416.57
7.4.100.0080.01216.64
7.4.90.0060.01116.63
7.4.80.0090.00916.56
7.4.70.0060.01316.54
7.4.60.0060.01016.36
7.4.50.0060.01216.54
7.4.40.0130.01016.53
7.4.30.0110.00716.51
7.4.20.0030.01416.63
7.4.10.0140.00316.56
7.4.00.0060.01016.70
7.3.330.0000.00816.49
7.3.320.0030.00313.42
7.3.310.0000.00716.45
7.3.300.0030.00316.29
7.3.290.0070.00916.48
7.3.260.0140.00416.67
7.3.230.0040.01316.64
7.3.210.0070.01116.49
7.3.200.0100.01316.53
7.3.190.0060.01216.53
7.3.180.0120.00616.52
7.3.170.0110.01116.48
7.3.160.0130.00916.66
7.3.150.0030.01416.75
7.3.140.0090.00616.48
7.3.130.0170.00016.64
7.3.120.0080.00816.65
7.3.110.0060.01216.25
7.3.100.0070.01116.30
7.3.90.0140.00416.59
7.3.80.0030.01316.45
7.3.70.0090.00916.34
7.3.60.0080.00816.51
7.3.50.0030.01616.45
7.3.40.0060.00916.54
7.3.30.0140.00316.43
7.3.20.0140.00316.59
7.3.10.0150.00416.51
7.3.00.0090.00916.45
7.2.330.0040.01316.48
7.2.320.0060.01816.48
7.2.310.0090.00916.59
7.2.300.0130.01016.65
7.2.290.0090.01316.61
7.2.280.0160.00316.54
7.2.270.0090.00916.75
7.2.260.0100.00616.69
7.2.250.0130.00316.80
7.2.240.0080.01116.68
7.2.230.0060.01216.78
7.2.220.0060.01116.63
7.2.210.0040.01316.84
7.2.200.0040.01416.58
7.2.190.0150.00416.68
7.2.180.0070.01016.79
7.2.170.0130.00316.72
7.2.160.0090.00916.50
7.2.150.0110.00816.61
7.2.140.0130.00716.85
7.2.130.0110.00716.67
7.2.120.0140.00416.69
7.2.110.0110.00716.69
7.2.100.0060.01216.74
7.2.90.0110.00816.60
7.2.80.0000.01816.88
7.2.70.0060.01716.66
7.2.60.0100.01316.71
7.2.50.0520.01016.70
7.2.40.0130.00616.68
7.2.30.0100.01016.84
7.2.20.0080.01116.79
7.2.10.0150.00316.48
7.2.00.0150.00316.90

preferences:
33.09 ms | 401 KiB | 5 Q