3v4l.org

run code in 300+ PHP versions simultaneously
<?php function extractRouteParameterComponents($routeParameter) { $regexPattern = "/^{(\w+)(?::(.+))?}(\?)?$/"; if (preg_match($regexPattern, $routeParameter, $matches)) { $name = $matches[1]; $type = $matches[2] ?? "[^/]"; $optional = isset($matches[3]) return [$name, $type, $optional]; } } $routeParameter = "{id:[0-9]+}?"; $parameterComponents = extractRouteParameterComponents($route); var_dump($parameterComponents);

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)
7.0.10.0070.06020.19
7.0.00.0070.08020.26
5.6.160.0100.08020.39
5.6.150.0130.04018.21
5.6.140.0100.06318.17
5.6.130.0130.07318.11
5.6.120.0000.04320.99
5.6.110.0030.04321.04
5.6.100.0030.05721.00
5.6.90.0100.08021.13
5.6.80.0100.07020.50
5.5.300.0130.03017.98
5.5.290.0100.03717.93
5.5.280.0170.04720.79
5.5.270.0070.04020.88
5.5.260.0000.04320.95
5.5.250.0100.08320.70
5.5.240.0230.06320.04

preferences:
142.79 ms | 1394 KiB | 7 Q