3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = <<<'STRING' //single line comment random text ... #another comment Multiline comments: /* this is a multiline comment with 'squote and "dquote" matches the whole thing */ // single line 'squoted' "dquoted" comment w/ extra " for no reason More comments <!-- yatta yatta yatta yatta --> Quotes: "also matches strings with \" escaped quotes or 'the other kind of quotation marks in it' " a "nested 'squote with nested \"dquote\"'" assuming only outermost quoting matters for formatting 'matches the end quote because it it not escaped \\' STRING; const PATTERN = <<<'PATTERN' ~(?|(")(?:[^"\\]|\\(?s).)*"|(')(?:[^'\\]|\\(?s).)*'|(#|//).*|(/\*)(?s).*?\*/|(<!--)(?s).*?-->)~ PATTERN; const LOOKUP = [ '#' => 'gainsboro', '//' => 'lightgrey', '/*' => 'silver', '<!--' => 'darkgrey', "'" => 'mint', '"' => 'aqua' ]; echo preg_replace_callback(PATTERN, function($m) { return "<span style=\"color:" . LOOKUP[$m[1]] . ";\">{$m[0]}</span>"; }, $string);

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.4.130.0090.00817.94
8.4.120.0040.00520.71
8.4.110.0120.00922.63
8.4.100.0040.00617.82
8.4.90.0080.00918.79
8.4.80.0030.00619.73
8.4.70.0050.00318.11
8.4.60.0090.01118.67
8.4.50.0110.00918.93
8.4.40.0050.00319.64
8.4.30.0160.00324.26
8.4.20.0110.01120.82
8.4.10.0100.01017.94
8.3.260.0120.00816.66
8.3.250.0090.00918.73
8.3.240.0100.00916.61
8.3.230.0120.00816.87
8.3.220.0100.00717.10
8.3.210.0100.00816.97
8.3.200.0040.00516.85
8.3.190.0050.00319.17
8.3.180.0040.00518.65
8.3.170.0110.00719.06
8.3.160.0070.01118.72
8.3.150.0110.00718.49
8.3.140.0050.00517.09
8.3.130.0070.00416.97
8.3.120.0040.00420.63
8.3.110.0150.00616.57
8.3.100.0130.00316.89
8.3.90.0100.01018.57
8.3.80.0090.00018.43
8.3.70.0150.00616.50
8.3.60.0000.01418.56
8.3.50.0070.00818.35
8.3.40.0160.00019.09
8.3.30.0110.00418.92
8.3.20.0070.00020.73
8.3.10.0000.00823.61
8.3.00.0090.00022.30
8.2.290.0040.00320.80
8.2.280.0120.00918.63
8.2.270.0070.01118.76
8.2.260.0090.00916.88
8.2.250.0030.00618.48
8.2.240.0040.00417.49
8.2.230.0030.00620.94
8.2.220.0000.00824.06
8.2.210.0040.00426.77
8.2.200.0060.00316.88
8.2.190.0060.01217.00
8.2.180.0100.01016.88
8.2.170.0110.00422.96
8.2.160.0080.00520.57
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0120.00619.78
8.2.110.0070.00320.39
8.2.100.0060.00618.03
8.2.90.0030.00517.88
8.2.80.0040.00417.97
8.2.70.0030.00618.02
8.2.60.0040.00418.34
8.2.50.0000.00818.10
8.2.40.0040.00419.41
8.2.30.0040.00420.62
8.2.20.0040.00418.11
8.2.10.0000.00819.42
8.2.00.0070.00018.17
8.1.330.0130.00521.90
8.1.320.0110.00518.39
8.1.310.0030.01418.79
8.1.300.0000.01418.54
8.1.290.0000.00918.88
8.1.280.0040.01125.92
8.1.270.0060.00323.88
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00323.83
8.1.230.0040.00719.08
8.1.220.0050.00317.77
8.1.210.0000.00818.77
8.1.200.0060.00317.48
8.1.190.0000.00817.48
8.1.180.0080.00018.10
8.1.170.0040.00418.70
8.1.160.0000.00818.90
8.1.150.0040.00418.90
8.1.140.0000.00718.96
8.1.130.0000.00720.34
8.1.120.0040.00417.55
8.1.110.0000.00717.71
8.1.100.0000.00717.56
8.1.90.0040.00417.59
8.1.80.0030.00717.64
8.1.70.0040.00417.64
8.1.60.0060.00617.69
8.1.50.0030.00517.74
8.1.40.0000.00917.73
8.1.30.0000.00917.85
8.1.20.0000.00817.80
8.1.10.0030.00517.66
8.1.00.0040.00717.61
8.0.300.0070.00019.77
8.0.290.0060.00317.00
8.0.280.0070.00018.36
8.0.270.0000.00717.23
8.0.260.0170.00324.86
8.0.250.0030.00317.22
8.0.240.0060.00417.13
8.0.230.0040.00417.07
8.0.220.0080.00017.11
8.0.210.0030.00317.00
8.0.200.0070.00017.19
8.0.190.0040.00417.16
8.0.180.0040.00417.18
8.0.170.0040.00417.16
8.0.160.0060.00317.23
8.0.150.0000.00717.07
8.0.140.0000.00717.13
8.0.130.0030.00313.54
8.0.120.0000.00816.99
8.0.110.0040.00416.94
8.0.100.0020.00516.97
8.0.90.0040.00417.01
8.0.80.0110.00617.10
8.0.70.0040.00417.12
8.0.60.0040.00417.15
8.0.50.0020.00517.02
8.0.30.0070.01517.30
8.0.20.0140.00617.21
8.0.10.0170.00317.23
8.0.00.0090.01217.18
7.4.330.0000.00516.79
7.4.320.0000.00616.80
7.4.300.0060.00016.71
7.4.290.0050.00216.62
7.4.280.0080.00016.82
7.4.270.0040.00416.70
7.4.260.0000.00716.74
7.4.250.0070.00016.71
7.4.240.0030.00316.74
7.4.230.0030.00416.64
7.4.220.0000.00716.86
7.4.210.0050.01216.79
7.4.200.0030.00316.89
7.4.160.0100.00716.84
7.4.150.0030.01916.83
7.4.140.0090.00916.79
7.4.130.0100.01116.73
7.4.120.0140.00716.73
7.4.110.0150.00616.80
7.4.100.0130.00516.81
7.4.90.0100.01016.84
7.4.80.0090.01218.08
7.4.70.0070.01016.87
7.4.60.0140.00616.77
7.4.50.0120.00616.68
7.4.40.0080.01016.77
7.4.30.0080.00816.71
7.4.20.0100.01016.73
7.4.10.0080.00816.76
7.4.00.0080.00815.89
7.3.330.0080.00013.47
7.3.320.0000.00613.39
7.3.310.0040.00416.39
7.3.300.0070.00016.54
7.3.290.0100.00316.51
7.3.280.0050.01016.51
7.3.270.0100.01016.49
7.3.260.0100.00816.60
7.3.250.0110.01116.47
7.3.240.0060.01316.65
7.3.230.0050.01316.55
7.3.220.0040.01716.46
7.3.210.0130.00816.59
7.3.200.0050.01316.54
7.3.190.0090.00616.63
7.3.180.0130.00816.47
7.3.170.0060.01116.48
7.3.160.0090.00916.52
7.3.150.0070.01116.45
7.3.140.0000.01516.48
7.3.130.0130.00316.42
7.3.120.0090.00616.39
7.3.110.0090.00816.39
7.3.100.0110.01116.30
7.3.90.0060.01316.71
7.3.80.0060.01216.48
7.3.70.0100.01016.48
7.3.60.0060.01116.56
7.3.50.0110.00516.55
7.3.40.0050.00915.78
7.3.30.0080.00615.69
7.3.20.0030.01215.62
7.3.10.0120.00715.71
7.3.00.0810.00615.71
7.2.340.0220.00716.69
7.2.330.0180.00516.84
7.2.320.0230.00616.73
7.2.310.0120.01016.81
7.2.300.0110.01316.85
7.2.290.0130.00916.81
7.2.280.0110.01516.63
7.2.270.0140.01116.68
7.2.260.0160.01316.73
7.2.250.0300.00616.77
7.2.240.0200.01316.73
7.2.230.0190.01416.77
7.2.220.0190.01216.68
7.2.210.0230.00816.74
7.2.200.0190.00816.82
7.2.190.0190.00716.76
7.2.180.0150.01216.78
7.2.170.0150.00516.01
7.2.160.0140.00715.82
7.2.150.0090.01716.04
7.2.140.0320.00616.07
7.2.130.0160.00315.99
7.2.120.0170.00616.05
7.2.110.0110.01015.97
7.2.100.0170.00516.08
7.2.90.0200.00515.91
7.2.80.0110.01316.10
7.2.70.0120.01015.97
7.2.60.0100.01215.99
7.2.50.0160.00916.11
7.2.40.0180.01116.04
7.2.30.0590.01015.98
7.2.20.0130.01016.20
7.2.10.0080.01416.02
7.2.00.0170.00816.07
7.1.330.0110.02315.74
7.1.320.0200.00815.81
7.1.310.0240.00015.71
7.1.300.0230.02315.73
7.1.290.0250.00715.58
7.1.280.0160.00914.89
7.1.270.0170.00714.96
7.1.260.0210.00814.80
7.1.250.0210.00514.72
7.1.240.0200.00415.61
7.1.230.0170.00615.70
7.1.220.0250.01115.64
7.1.210.0490.00915.69
7.1.200.0220.00315.61
7.1.190.0210.00415.67
7.1.180.0190.01315.66
7.1.170.0200.00815.58
7.1.160.0420.00615.64
7.1.150.0210.01115.64
7.1.140.0260.00815.71
7.1.130.0180.01415.68
7.1.120.0250.00815.70
7.1.110.0320.00015.73
7.1.100.0330.00915.72
7.1.90.0230.00515.79
7.1.80.0140.01115.82
7.1.70.0380.00715.59
7.1.60.0350.01115.73
7.1.50.0160.01615.77
7.1.40.0180.00715.77
7.1.30.0140.01115.80
7.1.20.0170.00815.82
7.1.10.0100.01715.72
7.1.00.0140.01015.61

preferences:
34.24 ms | 403 KiB | 5 Q