3v4l.org

run code in 300+ PHP versions simultaneously
<?php $headers = <<<HEADERS # Hello ## World ### Let's add ## Some headers ### Yay! # Foo ## Bar ## Bar Again HEADERS; $levels = []; echo preg_replace_callback( '~^(#+)\K~m', function($m) use (&$levels) { $hashes = strlen($m[1]); $index = $hashes - 1; $reduction = sizeof($levels) - $hashes; if (!isset($levels[$index])) { $levels[$index] = 1; } else { ++$levels[$index]; } if ($reduction > 0) { $levels = array_slice($levels, 0, -$reduction); } return " " . implode('.', $levels); }, $headers );

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.0150.00618.81
8.3.50.0130.00718.26
8.3.40.0090.00619.13
8.3.30.0150.00018.90
8.3.20.0040.00420.91
8.3.10.0080.00022.16
8.3.00.0040.00422.46
8.2.180.0040.01125.92
8.2.170.0110.00722.96
8.2.160.0110.00422.25
8.2.150.0090.00024.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0040.00419.61
8.2.110.0060.00321.16
8.2.100.0060.00617.97
8.2.90.0030.00618.00
8.2.80.0030.00717.97
8.2.70.0050.00317.93
8.2.60.0040.00418.19
8.2.50.0030.00618.10
8.2.40.0040.00419.44
8.2.30.0080.00019.49
8.2.20.0040.00418.13
8.2.10.0070.00019.34
8.2.00.0000.00718.17
8.1.280.0060.01225.92
8.1.270.0040.00418.87
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0000.00919.30
8.1.230.0090.00317.70
8.1.220.0080.00017.79
8.1.210.0000.01018.77
8.1.200.0060.00317.35
8.1.190.0040.00417.48
8.1.180.0040.00418.10
8.1.170.0030.00518.63
8.1.160.0060.00318.85
8.1.150.0080.00018.95
8.1.140.0000.00720.41
8.1.130.0030.00320.22
8.1.120.0040.00417.68
8.1.110.0000.00817.61
8.1.100.0000.00717.52
8.1.90.0000.00817.61
8.1.80.0040.00417.66
8.1.70.0040.00417.54
8.1.60.0040.00417.66
8.1.50.0030.00617.63
8.1.40.0000.00717.68
8.1.30.0000.00917.66
8.1.20.0060.00317.85
8.1.10.0070.00317.65
8.1.00.0070.00017.57
8.0.300.0040.00418.77
8.0.290.0060.00317.00
8.0.280.0030.00318.39
8.0.270.0030.00517.15
8.0.260.0000.00618.42
8.0.250.0030.00317.25
8.0.240.0000.00717.26
8.0.230.0030.00317.25
8.0.220.0030.00317.21
8.0.210.0000.00717.22
8.0.200.0030.00317.20
8.0.190.0000.00717.21
8.0.180.0000.00817.14
8.0.170.0030.00617.22
8.0.160.0040.00417.17
8.0.150.0070.00017.13
8.0.140.0040.00317.10
8.0.130.0000.00613.58
8.0.120.0050.00317.20
8.0.110.0040.00417.18
8.0.100.0000.00817.23
8.0.90.0070.00017.24
8.0.80.0090.00617.13
8.0.70.0020.00517.12
8.0.60.0040.00416.96
8.0.50.0040.00417.23
8.0.30.0140.00317.55
8.0.20.0130.00717.12
8.0.10.0000.00717.15
8.0.00.0120.00816.97
7.4.330.0050.00015.55
7.4.320.0000.00616.85
7.4.300.0030.00316.75
7.4.290.0070.00016.73
7.4.280.0000.00716.67
7.4.270.0080.00016.62
7.4.260.0000.00716.68
7.4.250.0030.00316.78
7.4.240.0000.00716.80
7.4.230.0030.00516.66
7.4.220.0040.00416.71
7.4.210.0090.00816.83
7.4.200.0000.00816.87
7.4.160.0100.00816.77
7.4.140.0070.01317.86
7.4.130.0180.00317.02
7.4.120.0120.00916.89
7.4.110.0150.00916.74
7.4.100.0060.01316.93
7.4.90.0100.00716.94
7.4.80.0090.00919.39
7.4.70.0080.00816.85
7.4.60.0030.01316.75
7.4.50.0030.01316.54
7.4.40.0110.00616.70
7.4.00.0120.00315.34
7.3.330.0060.00013.46
7.3.320.0060.00013.57
7.3.310.0000.00716.61
7.3.300.0030.00316.63
7.3.290.0050.00216.70
7.3.280.0080.01016.63
7.3.260.0130.00916.79
7.3.240.0110.00616.70
7.3.230.0060.01216.79
7.3.210.0100.00716.66
7.3.200.0030.01816.62
7.3.190.0030.01516.66
7.3.180.0120.00816.45
7.3.170.0060.01216.78
7.3.160.0040.01216.65
7.3.20.0130.00314.93
7.3.10.0670.01515.10
7.3.00.1790.00615.13
7.2.330.0070.01016.95
7.2.320.0100.01016.80
7.2.310.0060.01116.67
7.2.300.0050.01516.65
7.2.290.0120.00916.79
7.2.150.0050.01515.54
7.2.140.0120.00915.41
7.2.130.0710.00615.43
7.2.120.0220.00015.27
7.2.110.0130.00715.30
7.2.100.0180.00715.16
7.2.90.1150.00315.10
7.2.80.0140.00015.45
7.2.70.0390.00615.46
7.2.60.0400.01115.48
7.2.50.0290.01115.44
7.2.40.0360.00515.38
7.2.30.0130.00815.42
7.2.20.0300.00715.30
7.2.10.1180.00715.15
7.2.00.0140.00315.39
7.1.250.1280.01314.32

preferences:
62.06 ms | 400 KiB | 5 Q