3v4l.org

run code in 300+ PHP versions simultaneously
<?php $regex = <<<REGEX ~ ^ # start of string anchor (CONF|ESD|TRACKING) # start capture group 1 KEY, three literal words (?: # start non-capturing group 1 \h*[:;'\h]\h* # require a listed punctuation or space with optional leading or trailing spaces (\S+(?:\h+\S+)*?) # start capture group 2 LINE, require one or more non-whitespace characters then lazily match zero or more repetitions of whitespace then non-whitespace substrings (?: # start non-capturing group 2 \h*L\h*[:;'\h]\h* # require literal L then a listed punctuation or space with optional leading or trailing spaces ( # start capture group 3 LINE_DATA (?:\d+(?:\(\d+\))?) # require a number optionally followed by another number in parentheses (?:\h*,\h*\d+(?:\(\d+\))?)* # optionally match zero or more repetitions of the previous expression if separated by an optionally space-padded comma ) # end capture group 3 and make it optional )? # end non-capturing group 2 (?: # start non-capturing group 3 \h* # match zero or more whitespaces ( # start capture group 4 INITIALS \*[.a-z]+ # match literal asterisk, then one or more dots and letters ) # end capture group 4 )? # end non-capturing group 3 and make it optional )? # end non-capturing group 2 and make it optional \h* # allow trailing whitespaces $ # end of string anchor ~ix REGEX; $tests = [ "esd hedf L:1,2,3 *sm ", "CONF: FEDEX 12345 L: 12(2),2(9),32 *SM", "Tracking *cool", "ESD: 12/12/92 L: ", "tRacking' my data L: 1,2,3(4) ", "conf something *asterisk", "tracking", "ConF''' something '' L: 6", "esd test 24(7)", ]; foreach ($tests as $i => $test) { if (preg_match($regex, $test, $m, PREG_UNMATCHED_AS_NULL)) { var_export([ "test index" => $i, "KEY" => $m[1], "LINE" => $m[2] ?? null, "LINE_DATA" => $m[3] ?? null, "INITIALS" => $m[4] ?? null ]); echo "\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.60.0070.01716.88
8.3.50.0120.00620.32
8.3.40.0000.01420.68
8.3.30.0030.01318.92
8.3.20.0040.00424.18
8.3.10.0050.00524.66
8.3.00.0080.00026.16
8.2.170.0030.01319.13
8.2.160.0100.00322.96
8.2.150.0070.00025.66
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0000.00821.13
8.2.110.0070.00320.37
8.2.100.0100.00018.03
8.2.90.0000.00817.97
8.2.80.0070.00417.97
8.2.70.0060.00317.85
8.2.60.0000.00817.88
8.2.50.0050.00317.88
8.2.40.0050.00519.61
8.2.30.0040.00417.80
8.2.20.0030.00620.36
8.2.10.0040.00418.05
8.2.00.0040.00419.36
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0000.00922.65
8.1.230.0070.00722.73
8.1.220.0080.00017.77
8.1.210.0050.00318.85
8.1.200.0040.00417.35
8.1.190.0000.00817.36
8.1.180.0050.00318.10
8.1.170.0030.00617.62
8.1.160.0070.00018.86
8.1.150.0000.00818.82
8.1.140.0040.00417.68
8.1.130.0070.00020.36
8.1.120.0040.00417.66
8.1.110.0040.00417.62
8.1.100.0000.00717.63
8.1.90.0000.00817.56
8.1.80.0060.00317.52
8.1.70.0050.00317.59
8.1.60.0050.00317.66
8.1.50.0030.00517.57
8.1.40.0060.00617.68
8.1.30.0040.00417.76
8.1.20.0060.00317.85
8.1.10.0090.00017.78
8.1.00.0030.00617.60
8.0.300.0070.00020.11
8.0.290.0000.00817.00
8.0.280.0030.00318.16
8.0.270.0070.00017.11
8.0.260.0000.00618.51
8.0.250.0110.00017.09
8.0.240.0040.00417.19
8.0.230.0030.00317.09
8.0.220.0030.00317.17
8.0.210.0070.00017.00
8.0.200.0040.00417.16
8.0.190.0080.00017.15
8.0.180.0000.00717.09
8.0.170.0040.00417.20
8.0.160.0110.00017.09
8.0.150.0050.00317.02
8.0.140.0000.00817.09
8.0.130.0040.00417.04
8.0.120.0040.00417.13
8.0.110.0030.00516.99
8.0.100.0030.00517.04
8.0.90.0050.00317.10
8.0.80.0050.00317.04
8.0.70.0090.00017.15
8.0.60.0000.00817.06
8.0.50.0030.00617.02
8.0.30.0040.00417.18
8.0.20.0050.00517.11
8.0.10.0040.00417.24
7.4.330.0050.00015.55
7.4.320.0060.00016.83
7.4.300.0030.00316.64
7.4.290.0030.00316.68
7.4.280.0040.00416.84
7.4.270.0070.00016.82
7.4.260.0040.00416.59
7.4.250.0000.00716.74
7.4.240.0000.00816.85
7.4.230.0000.00716.83
7.4.220.0000.00716.70
7.4.210.0000.01016.73
7.4.200.0030.00616.78
7.4.190.0040.00416.88
7.4.180.0030.00616.80
7.4.160.0040.00416.80
7.4.150.0070.00016.70
7.4.140.0000.00816.73
7.4.130.0000.00716.63
7.4.120.0030.00316.74
7.4.110.0070.00016.66
7.4.100.0040.00416.82
7.4.90.0030.00316.63
7.4.80.0040.00416.84
7.4.70.0000.00816.79
7.4.60.0030.00516.76
7.4.50.0000.00816.60
7.4.40.0040.00416.59
7.4.30.0050.00316.73
7.4.20.0040.00416.64
7.4.10.0000.00716.68
7.4.00.0040.00416.64

preferences:
51.77 ms | 400 KiB | 5 Q