3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = <<<FOO #shit ## #shit2 #sshit3 mine_sht : carftj ### 漢字漢字貔貅 tv: tee # # HI tvw: 9 #haha #aa 9abaa: ahah #heuens FOO; preg_match_all('~^\s*(?:(\w+)\s*:.[^\r\n#]*([^\r\n]*#*)?)?(#*(?:[^\r\n]|[\r\n]#)*)~um', $data, $matches); ///print_r($matches); $doc = ""; foreach($matches[1] as $i => $m) { $s = preg_replace('/\s+/', '', $m); //Remove whitespace if (str_starts_with($s, "#") || empty($s)){ //Valid next comment line $doc .= $matches[3][$i] . PHP_EOL; //Adding comments //print("DOC LOG: " . $doc . PHP_EOL); //LOG DOC continue; } print("KEY:\n" . $m . "\nDOC:\n" . $doc . "\nIDOC:\n" . $matches[2][$i] . "\n"); print("--------------------------------------------------\n"); $doc = $matches[3][$i]; //print("OPEN: ". $m . "-CLOSED\n"); }

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.120.0060.00319.04
8.3.110.0000.00716.88
8.3.100.0100.00317.08
8.3.90.0080.00026.77
8.3.80.0040.00417.13
8.3.70.0110.00416.73
8.3.60.0070.00718.68
8.3.50.0040.01518.92
8.3.40.0130.00319.17
8.3.30.0140.00019.20
8.3.20.0000.00824.18
8.3.10.0050.00324.66
8.3.00.0080.00026.16
8.2.240.0090.00018.61
8.2.230.0050.00520.94
8.2.220.0030.00524.06
8.2.210.0000.00826.77
8.2.200.0030.00616.88
8.2.190.0180.00616.63
8.2.180.0130.00625.92
8.2.170.0110.01119.17
8.2.160.0030.01022.96
8.2.150.0040.00425.66
8.2.140.0030.00524.66
8.2.130.0090.00926.16
8.2.120.0030.00526.16
8.2.110.0070.00322.30
8.2.100.0120.00017.95
8.2.90.0050.00318.00
8.2.80.0000.00819.02
8.2.70.0040.00417.88
8.2.60.0040.00417.75
8.2.50.0040.00417.98
8.2.40.0080.00018.22
8.2.30.0050.00218.31
8.2.20.0040.00420.45
8.2.10.0050.00218.18
8.2.00.0050.00319.54
8.1.300.0050.00318.32
8.1.290.0040.00430.84
8.1.280.0120.00925.92
8.1.270.0000.00723.99
8.1.260.0000.00826.35
8.1.250.0110.00428.09
8.1.240.0060.00323.91
8.1.230.0040.00819.04
8.1.220.0090.00017.78
8.1.210.0050.00318.77
8.1.200.0040.00417.48
8.1.190.0030.00617.24
8.1.180.0060.00318.10
8.1.170.0040.00417.62
8.1.160.0040.00418.86
8.1.150.0040.00418.87
8.1.140.0070.00317.59
8.1.130.0070.00019.00
8.1.120.0070.00317.63
8.1.110.0070.00017.52
8.1.100.0030.00517.68
8.1.90.0000.00717.65
8.1.80.0050.00217.66
8.1.70.0000.00817.53
8.1.60.0100.00617.68
8.1.50.0120.00717.72
8.1.40.0070.01017.65
8.1.30.0140.00317.77
8.1.20.0100.00617.67
8.1.10.0070.00717.62
8.1.00.0050.01117.74
8.0.300.0000.00719.80
8.0.290.0070.00417.13
8.0.280.0030.00318.47
8.0.270.0000.00717.05
8.0.260.0000.00818.36
8.0.250.0070.00017.16
8.0.240.0000.00717.31
8.0.230.0070.00017.26
8.0.220.0000.00717.23
8.0.210.0070.00017.26
8.0.200.0030.00317.11
8.0.190.0090.00317.19
8.0.180.0100.00517.02
8.0.170.0120.00417.15
8.0.160.0130.00317.17
8.0.150.0120.00417.11
8.0.140.0040.01117.06
8.0.130.0120.00417.10
8.0.120.0030.01117.15
8.0.110.0090.00617.19
8.0.100.0080.00817.08
8.0.90.0110.00417.19
8.0.80.0120.00017.11
8.0.70.0070.00417.06
8.0.60.0100.00717.19
8.0.50.0130.00316.97
8.0.30.0070.01017.20
8.0.20.0090.00517.18
8.0.10.0110.00417.27
7.4.330.0050.00015.55
7.4.320.0000.00616.77
7.4.300.0030.00316.77
7.4.290.0140.00416.78
7.4.280.0100.00816.90
7.4.270.0090.00516.86
7.4.260.0080.00516.92
7.4.250.0050.01416.86
7.4.240.0130.00316.93
7.4.230.0190.00016.88
7.4.220.0130.00316.77
7.4.210.0110.00616.61
7.4.200.0070.01016.78
7.4.190.0130.00316.89
7.4.180.0080.00416.79
7.4.160.0120.00316.89
7.4.150.0110.00416.57
7.4.140.0110.00416.77
7.4.130.0100.00316.58
7.4.120.0110.00616.81
7.4.110.0100.00716.75
7.4.100.0100.00516.85
7.4.90.0140.00016.56
7.4.80.0050.00816.88
7.4.70.0060.00616.70
7.4.60.0080.00416.79
7.4.50.0130.00016.66
7.4.40.0090.00216.67
7.4.30.0130.00016.59
7.4.20.0040.00716.62
7.4.10.0090.00316.64
7.4.00.0070.00216.75

preferences:
28.02 ms | 403 KiB | 5 Q