3v4l.org

run code in 500+ PHP versions simultaneously
<?php // the input $input = <<<STR section subsection text STR; // determine initial whitespace length preg_match('/^(?<initial>\s*)/', $input, $match); ['initial' => $initialWhiteSpace] = $match; $whiteSpaceLength = strlen($initialWhiteSpace); // convert string to array of lines $lines = explode(PHP_EOL, $input); // replace the white-space $output = array_map( static fn (string $str): string => preg_replace(sprintf("/^[ \t]{%d}/", $whiteSpaceLength), '', $str), $lines, ); // recreate the string $output = implode(PHP_EOL, $output); echo $output;

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.5.70.0080.00316.92
8.5.60.0100.00917.11
8.5.50.0120.00416.61
8.5.30.0090.00820.39
8.5.20.0080.01019.18
8.5.10.0120.00618.46
8.5.00.0180.00720.27
8.4.210.0060.00319.83
8.4.180.0130.00820.63
8.4.170.0110.01021.92
8.4.160.0120.01123.68
8.4.150.0080.00516.87
8.4.140.0230.01117.78
8.4.130.0110.01018.47
8.4.120.0140.00718.15
8.4.110.0050.00326.04
8.4.100.0090.00918.08
8.4.90.0040.00420.83
8.4.80.0080.00719.23
8.4.70.0030.00619.11
8.4.60.0080.01219.18
8.4.50.0120.00820.80
8.4.40.0130.00719.73
8.4.30.0100.01018.63
8.4.20.0120.00819.82
8.4.10.0120.00320.46
8.3.300.0120.00918.94
8.3.290.0080.01020.79
8.3.280.0120.00818.57
8.3.270.0120.00816.72
8.3.260.0140.00516.75
8.3.250.0050.00616.61
8.3.240.0130.00616.69
8.3.230.0120.00616.67
8.3.220.0040.00418.79
8.3.210.0070.00218.72
8.3.200.0090.00016.85
8.3.190.0040.00517.09
8.3.180.0100.00918.73
8.3.170.0120.00616.98
8.3.160.0040.01417.36
8.3.150.0110.00719.04
8.3.140.0080.00817.18
8.3.130.0050.00318.84
8.3.120.0060.00319.10
8.3.110.0000.00820.94
8.3.100.0000.00918.58
8.3.90.0080.00326.77
8.3.80.0070.00316.85
8.3.70.0070.00716.75
8.3.60.0060.00916.63
8.3.50.0110.00718.60
8.3.40.0130.00319.23
8.3.30.0040.01119.35
8.3.20.0020.00524.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.300.0120.00922.14
8.2.290.0120.00716.76
8.2.280.0090.01018.64
8.2.270.0130.00719.17
8.2.260.0160.00316.63
8.2.250.0150.00416.65
8.2.240.0030.00517.53
8.2.230.0000.00822.58
8.2.220.0040.00424.06
8.2.210.0060.00326.77
8.2.200.0000.00916.61
8.2.190.0180.00416.72
8.2.180.0110.01125.92
8.2.170.0120.00322.96
8.2.160.0070.00722.96
8.2.150.0060.00325.66
8.2.140.0070.00024.66
8.2.130.0050.00326.16
8.2.120.0020.00520.08
8.2.110.0060.00320.53
8.2.100.0120.00018.16
8.2.90.0050.00318.00
8.2.80.0030.00619.05
8.2.70.0030.00517.88
8.2.60.0000.00918.05
8.2.50.0070.00318.07
8.2.40.0030.00718.28
8.2.30.0000.00818.22
8.2.20.0000.00720.50
8.2.10.0040.00418.13
8.2.00.0040.00419.39
8.1.340.0130.00918.04
8.1.330.0100.00916.45
8.1.320.0120.00718.24
8.1.310.0120.00618.28
8.1.300.0040.00420.24
8.1.290.0070.00330.84
8.1.280.0070.00725.92
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0030.00620.84
8.1.230.0030.00922.25
8.1.220.0040.00817.74
8.1.210.0040.00418.77
8.1.200.0040.00417.48
8.1.190.0060.00317.35
8.1.180.0080.00018.10
8.1.170.0030.00618.78
8.1.160.0000.00718.99
8.1.150.0070.00018.77
8.1.140.0000.00717.68
8.1.130.0000.00718.97
8.1.120.0000.00717.62
8.1.110.0000.00717.52
8.1.100.0000.00717.64
8.1.90.0030.00517.51
8.1.80.0040.00417.63
8.1.70.0000.00717.54
8.1.60.0040.00417.73
8.1.50.0100.01017.74
8.1.40.0160.00317.66
8.1.30.0210.00017.74
8.1.20.0060.01217.73
8.1.10.0100.00717.71
8.1.00.0230.00317.64
8.0.300.0050.00218.77
8.0.290.0000.00716.88
8.0.280.0030.00318.48
8.0.270.0030.00517.03
8.0.260.0000.00818.38
8.0.250.0040.00717.17
8.0.240.0070.00017.03
8.0.230.0000.00717.05
8.0.220.0070.00017.18
8.0.210.0050.00216.98
8.0.200.0040.00417.22
8.0.190.0000.00817.09
8.0.180.0100.01016.98
8.0.170.0160.00317.14
8.0.160.0150.00317.15
8.0.150.0160.00317.08
8.0.140.0150.00316.91
8.0.130.0180.00416.97
8.0.120.0130.00717.14
8.0.110.0150.00417.08
8.0.100.0100.01017.07
8.0.90.0200.00016.97
8.0.80.0150.00717.00
8.0.70.0180.00316.99
8.0.60.0130.00517.05
8.0.50.0100.00517.04
8.0.30.0100.00516.95
8.0.20.0090.00917.22
8.0.10.0140.00417.19
7.4.330.0020.00215.55
7.4.320.0000.00716.86
7.4.300.0060.00016.78
7.4.290.0130.00416.75
7.4.280.0120.01216.82
7.4.270.0190.00316.82
7.4.260.0090.00316.81
7.4.250.0160.00716.75
7.4.240.0130.00316.73
7.4.230.0050.00516.81
7.4.220.0190.00016.86
7.4.210.0130.00616.90
7.4.200.0110.00016.90
7.4.190.0110.00016.83
7.4.180.0180.00016.62
7.4.160.0100.01016.66
7.4.150.0080.01116.77
7.4.140.0100.00516.77
7.4.130.0150.00416.70
7.4.120.0110.00816.77
7.4.110.0130.00616.62
7.4.100.0170.00316.65
7.4.90.0140.00516.60
7.4.80.0140.00616.73
7.4.70.0160.00416.67
7.4.60.0130.00716.75
7.4.50.0140.00616.57
7.4.40.0070.01216.75
7.4.30.0100.01016.71
7.4.20.0060.00916.65
7.4.10.0060.00316.57
7.4.00.0050.00516.80

preferences:
108.45 ms | 1253 KiB | 5 Q