3v4l.org

run code in 300+ PHP versions simultaneously
<?php #BLM final class ABNFParser { private const ABNF_REGEX = <<<'REGEX' (?(DEFINE) (?<ALPHA>[A-Za-z]) (?<DIGIT>[0-9]) (?<SP>[\x20]) (?<WSP>[(?&SP)\x09]) (?<CR>\x0D) (?<LF>\x0A) (?<Repeat>(?:(?:(?&DIGIT)+(?:(?&DIGIT)*[\x2A](?&DIGIT)*)))) ) REGEX; public function parse(string $input, string $rule): ?string { // Build the query pattern dynamically based on the provided rule $pattern = sprintf('#%s(?&%s)#Aux', self::ABNF_REGEX, $rule); if (preg_match($pattern, $input, $matches)) { return $matches[0]; } return null; } } # Example Usage $parser = new ABNFParser(); $input = '2*4'; $rule = 'Repeat'; $parsedResult = $parser->parse($input, $rule); var_dump($parsedResult); // Outputs: string(3) "2*4"

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.0150.00618.00
8.4.120.0130.00720.57
8.4.110.0100.01022.46
8.4.100.0090.00918.96
8.4.90.0040.00518.73
8.4.80.0070.00219.02
8.4.70.0050.00920.48
8.4.60.0060.00318.81
8.4.50.0110.01018.53
8.4.40.0090.00617.72
8.4.30.0130.00320.78
8.4.20.0170.00319.78
8.4.10.0090.00019.83
8.3.260.0170.00316.74
8.3.250.0140.00618.95
8.3.240.0100.00817.05
8.3.230.0130.00716.89
8.3.220.0090.00718.83
8.3.210.0050.00316.90
8.3.200.0140.00516.78
8.3.190.0060.00317.04
8.3.180.0120.00618.78
8.3.170.0090.00617.42
8.3.160.0090.00918.62
8.3.150.0120.00316.89
8.3.140.0080.00017.10
8.3.130.0030.00718.64
8.3.120.0090.00019.16
8.3.110.0350.01016.98
8.3.100.0410.00916.97
8.3.90.0370.01016.48
8.3.80.0420.00916.50
8.3.70.0470.00716.50
8.3.60.0440.00716.88
8.3.50.0370.00816.75
8.3.40.0220.01517.88
8.3.30.0270.01517.63
8.3.20.0450.00017.63
8.3.10.0290.00717.75
8.3.00.0360.00717.63
8.2.290.0140.00520.50
8.2.280.0130.00718.46
8.2.270.0100.01016.98
8.2.260.0040.00416.80
8.2.250.0080.00018.65
8.2.240.0030.00519.09
8.2.230.0260.00716.71
8.2.220.0330.01016.76
8.2.210.0340.00316.52
8.2.200.0320.00316.63
8.2.190.0350.00416.75
8.2.180.0280.00916.37
8.2.170.0340.01017.63
8.2.160.0310.01217.63
8.2.150.0370.01117.34
8.2.140.0430.00417.59
8.2.130.0340.01017.62
8.2.120.0290.01517.73
8.2.110.0320.00617.73
8.2.100.0330.01017.63
8.2.90.0370.00617.86
8.2.80.0330.01317.38
8.2.70.0250.01117.48
8.2.60.0330.00917.38
8.2.50.0210.02117.25
8.2.40.0210.01217.88
8.2.30.0420.01417.50
8.2.20.0440.00317.50
8.2.10.0360.00417.50
8.2.00.0280.01217.50
8.1.330.0100.00822.03
8.1.320.0090.01017.94
8.1.310.0000.00816.41
8.1.300.0090.00920.33
8.1.290.0310.01316.25
8.1.280.0380.00615.86
8.1.270.0240.00817.25
8.1.260.0330.00317.50
8.1.250.0250.01117.50
8.1.240.0280.01017.38
8.1.230.0320.00717.38
8.1.220.0300.01017.34
8.1.210.0320.01017.25
8.1.200.0280.01117.22
8.1.190.0280.01116.98
8.1.180.0300.00917.38
8.1.170.0350.00317.36
8.1.160.0210.02517.25
8.1.150.0340.00717.38
8.1.140.0380.00317.23
8.1.130.0210.01017.38
8.1.120.0260.00617.38
8.1.110.0230.01217.38
8.1.100.0260.00717.25
8.1.90.0330.00617.35
8.1.80.0250.00917.34
8.1.70.0230.00817.34
8.1.60.0360.00017.38
8.1.50.0340.00817.47
8.1.40.0330.00917.35
8.1.30.0230.00417.50
8.1.20.0290.01517.36
8.1.10.0260.02017.34
8.1.00.0420.00017.47

preferences:
28.81 ms | 403 KiB | 5 Q