3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Route { const RESOURCE_PATTERN = '/'.'\[:(.*)\]'.'/'; const TOKEN_PARA_PATTERN = '/'.'\{:(.*)\}'.'/'; private $methodList; private $url; private $urlTokenList; private $urlTokenCount; private $controller; private $action; private $tokenParameterList; private $resourceList = array(); private $resourceDetailList = array(); public function __construct($httpMethod, $httpUrl, $controller, $action) { $this->methodList = explode('|', $httpMethod); $this->httpUrl = $httpUrl; $this->controller = $controller; $this->action = $action; $this->parseURL($httpUrl); } public function parseURL($url) { $tmpUrl = $url; if (substr($tmpUrl, 0, 1) == '/') { $tmpUrl = substr($tmpUrl, 1); } if (substr($tmpUrl, -1) == '/') { $tmpUrl = substr($tmpUrl, 0, -1); } $this->urlTokenList = explode('/', $tmpUrl); $this->urlTokenCount = count($this->urlTokenList); foreach($this->urlTokenList as $token) { $isMatchedForResourcePattern = preg_match(self::RESOURCE_PATTERN, $token, $resourceMatches, PREG_OFFSET_CAPTURE); if ($isMatchedForResourcePattern === 1) { array_push($this->resourceList, $resourceMatches[1][0]); } $isMatchedForParaPattern = preg_match(self::TOKEN_PARA_PATTERN, $token, $paramMatches, PREG_OFFSET_CAPTURE); } } public function getMethodList() { return $this->methodList; } public function getUrl() { return $this->url; } public function getUrlTokenList() { return $this->urlTokenList; } public function getUrlTokenCount() { return $this->urlTokenCount; } public function getController() { return $this->controller; } public function getAction() { return $this->action; } public function getTokenParameterList() { return $this->tokenParameterList; } public function getResourceList() { return $this->resourceList; } public function getResourceDetailList() { return $this->resourceDetailList; } public function isMatched($url) { return 0; } } $ROUTES = array( array('httpMethod' => 'GET', 'url' => '[:music_category]/xml', 'controller' => 'CategoryController', 'action' => 'xml'), array('httpMethod' => 'GET', 'url' => '[:music_category]/json', 'controller' => 'CategoryController', 'action' => 'json'), array('httpMethod' => 'GET|POST', 'url' => 'xml', 'controller' => 'temp_controller', 'action' => 'xml'), array('httpMethod' => 'GET|POST', 'url' => 'json', 'controller' => 'temp_controller', 'action' => 'json'), array('httpMethod' => 'GET|POST', 'url' => 'post/[:music_category]/{:data}/xml', 'controller' => 'CategoryController', 'action' => 'post') ); foreach ($ROUTES as $route) { $routeObj = new Route($route['httpMethod'], $route['url'], $route['controller'], $route['action']); print_r($routeObj->getMethodList()); printf($routeObj->getUrl()); print_r($routeObj->getUrlTokenList()); printf($routeObj->getController()); printf($routeObj->getAction()); print_r($routeObj->getTokenParameterList()); print_r($routeObj->getResourceList()); print_r($routeObj->getResourceDetailList()); }

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.0150.00318.81
8.3.50.0180.00522.00
8.3.40.0040.01119.22
8.3.30.0110.00419.24
8.3.20.0030.00520.39
8.3.10.0040.00423.66
8.3.00.0090.00019.75
8.2.180.0080.00818.83
8.2.170.0070.01122.96
8.2.160.0070.01120.52
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0050.00326.16
8.2.120.0030.00619.54
8.2.110.0070.00322.28
8.2.100.0060.00618.00
8.2.90.0050.00319.12
8.2.80.0030.00517.97
8.2.70.0000.00817.75
8.2.60.0090.00017.93
8.2.50.0030.00618.07
8.2.40.0080.00018.02
8.2.30.0030.00618.25
8.2.20.0000.00917.87
8.2.10.0000.00818.15
8.2.00.0040.00417.96
8.1.280.0110.00425.92
8.1.270.0000.00923.73
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0040.00423.84
8.1.230.0040.00819.16
8.1.220.0000.00817.76
8.1.210.0030.00518.77
8.1.200.0060.00617.50
8.1.190.0000.00817.36
8.1.180.0040.00418.10
8.1.170.0040.00418.84
8.1.160.0000.00722.07
8.1.150.0040.00419.00
8.1.140.0040.00417.59
8.1.130.0040.00417.88
8.1.120.0040.00417.64
8.1.110.0000.00817.67
8.1.100.0000.00817.53
8.1.90.0070.00017.70
8.1.80.0000.00717.62
8.1.70.0050.00217.61
8.1.60.0040.00417.75
8.1.50.0090.00017.58
8.1.40.0000.00817.64
8.1.30.0030.00617.77
8.1.20.0000.00817.74
8.1.10.0040.00417.79
8.1.00.0130.00017.57
8.0.300.0040.00418.77
8.0.290.0050.00217.00
8.0.280.0000.00718.54
8.0.270.0040.00417.22
8.0.260.0030.00317.30
8.0.250.0030.00317.14
8.0.240.0040.00417.16
8.0.230.0030.00317.00
8.0.220.0040.00416.94
8.0.210.0000.00717.09
8.0.200.0000.00817.14
8.0.190.0030.00617.12
8.0.180.0040.00417.09
8.0.170.0030.00616.95
8.0.160.0050.00217.06
8.0.150.0040.00417.05
8.0.140.0040.00417.03
8.0.130.0070.00013.45
8.0.120.0030.00617.07
8.0.110.0040.00417.08
8.0.100.0040.00417.03
8.0.90.0070.00016.87
8.0.80.0070.00817.09
8.0.70.0000.00717.07
8.0.60.0060.00316.92
8.0.50.0040.00416.90
8.0.30.0060.01317.09
8.0.20.0130.00717.40
8.0.10.0040.00417.08
8.0.00.0110.00817.04
7.4.330.0000.00515.02
7.4.320.0000.00716.86
7.4.300.0000.00616.84
7.4.290.0030.00316.89
7.4.280.0030.00516.85
7.4.270.0030.00316.85
7.4.260.0000.00816.89
7.4.250.0040.00416.61
7.4.240.0050.00316.75
7.4.230.0030.00316.96
7.4.220.0080.01116.85
7.4.210.0090.00616.70
7.4.200.0050.00316.85
7.4.160.0000.01616.93
7.4.150.0040.01417.40
7.4.140.0080.01117.86
7.4.130.0120.00816.80
7.4.120.0090.01016.68
7.4.110.0060.01216.43
7.4.100.0110.00816.80
7.4.90.0070.01016.73
7.4.80.0090.00919.39
7.4.70.0120.00617.07
7.4.60.0120.00616.68
7.4.50.0000.00416.43
7.4.40.0070.01016.70
7.4.30.0090.00816.71
7.4.00.0130.00515.33
7.3.330.0030.00313.46
7.3.320.0000.00613.54
7.3.310.0000.00816.51
7.3.300.0080.00016.51
7.3.290.0080.00816.53
7.3.280.0060.00916.53
7.3.270.0100.00717.40
7.3.260.0070.01116.58
7.3.250.0180.00316.59
7.3.240.0130.01016.80
7.3.230.0100.01016.51
7.3.210.0090.01216.77
7.3.200.0060.01619.39
7.3.190.0170.00016.70
7.3.180.0080.00816.57
7.3.170.0110.00616.82
7.3.160.0100.00616.59
7.3.120.0090.00915.01
7.3.110.0060.01214.88
7.3.100.0060.00915.22
7.3.90.0030.00715.06
7.3.80.0060.00614.82
7.3.70.0030.01315.15
7.3.60.0100.00315.18
7.3.50.0030.00914.71
7.3.40.0090.00014.84
7.3.30.0060.00615.11
7.3.20.0060.00616.80
7.3.10.0070.01016.88
7.3.00.0070.00417.00
7.2.330.0120.00817.03
7.2.320.0070.01816.75
7.2.310.0110.00616.91
7.2.300.0140.00317.02
7.2.290.0160.00616.96
7.2.250.0090.00915.34
7.2.240.0030.01715.19
7.2.230.0100.00615.49
7.2.220.0100.00715.50
7.2.210.0070.00715.44
7.2.200.0060.00915.26
7.2.190.0040.01115.20
7.2.180.0030.01315.27
7.2.170.0040.01214.98
7.2.00.0070.00719.74
7.1.330.0000.01516.05
7.1.320.0060.00616.16
7.1.310.0000.01116.18
7.1.300.0090.00615.96
7.1.290.0070.01016.10
7.1.280.0100.00315.97
7.1.270.0040.01415.94
7.1.260.0030.01315.82
7.1.100.0000.00818.13
7.1.70.0060.00917.46
7.1.60.0130.01319.32
7.1.50.0160.00616.83
7.1.00.0030.07722.46
7.0.200.0090.00016.80
7.0.140.0030.07722.10
7.0.60.0100.03320.10
7.0.50.0130.06717.92
7.0.40.0100.07020.27
7.0.30.0370.04320.27
7.0.20.0230.04320.31
7.0.10.0430.03020.17
7.0.00.0130.08320.25
5.6.210.0030.08020.73
5.6.200.0130.08318.20
5.6.190.0100.08320.33
5.6.180.0370.07020.63
5.6.170.0300.05020.52
5.6.160.0030.07320.62
5.6.150.0070.08718.19
5.6.140.0100.04718.27
5.6.130.0100.07718.21
5.6.120.0100.03721.04
5.6.110.0070.08721.00
5.6.100.0000.09021.12
5.6.90.0070.08321.00
5.6.80.0030.04020.32
5.6.70.3530.04020.55
5.5.350.0200.07320.42
5.5.340.0030.07718.05
5.5.330.0070.08720.27
5.5.320.0530.06020.42
5.5.310.0230.07320.22
5.5.300.0170.07017.97
5.5.290.0070.03717.95
5.5.280.0100.07720.76
5.5.270.0100.05320.79
5.5.260.0170.07720.78
5.5.250.0070.08720.71
5.5.240.0270.05020.11
5.4.450.0600.05719.56
5.4.440.0930.06019.34
5.4.430.0870.05719.60
5.4.420.0930.04319.46
5.4.410.0870.07719.04
5.4.400.0470.08018.81
5.4.390.0400.05018.70
5.4.380.0600.06718.79
5.4.370.0500.05318.74
5.4.360.0470.06318.72
5.4.350.0330.07318.81
5.4.340.0030.03612.02
5.4.320.0040.03712.50
5.4.310.0080.03612.50
5.4.300.0050.03712.51
5.4.290.0050.03912.50
5.4.280.0040.03612.40
5.4.270.0080.03412.40
5.4.260.0070.03712.40
5.4.250.0040.04112.40
5.4.240.0040.04212.40
5.4.230.0040.03812.39
5.4.220.0080.03412.39
5.4.210.0050.03612.39
5.4.200.0070.03612.39
5.4.190.0060.03712.39
5.4.180.0050.04112.39
5.4.170.0060.04112.39
5.4.160.0050.03812.39
5.4.150.0100.03212.39
5.4.140.0040.03912.08
5.4.130.0040.03812.06
5.4.120.0050.03712.03
5.4.110.0080.03512.02
5.4.100.0080.03312.02
5.4.90.0040.03812.02
5.4.80.0060.03612.02
5.4.70.0020.03812.02
5.4.60.0070.03412.02
5.4.50.0060.03412.02
5.4.40.0070.03412.01
5.4.30.0100.03712.00
5.4.20.0060.03812.00
5.4.10.0050.03612.00
5.4.00.0100.03211.50
5.3.290.0060.03912.80
5.3.280.0050.03912.71
5.3.270.0060.04012.73
5.3.260.0050.04112.72
5.3.250.0070.03612.72
5.3.240.0040.04012.72
5.3.230.0080.03712.71
5.3.220.0050.04212.68
5.3.210.0090.03812.68
5.3.200.0100.03412.68
5.3.190.0060.03712.68
5.3.180.0050.04712.68
5.3.170.0090.04112.67
5.3.160.0030.03912.67
5.3.150.0070.03712.67
5.3.140.0080.03512.66
5.3.130.0090.04512.65
5.3.120.0080.03712.66
5.3.110.0070.03612.66
5.3.100.0060.03612.12
5.3.90.0050.03712.10
5.3.80.0040.03812.09
5.3.70.0070.04112.09
5.3.60.0050.03812.08
5.3.50.0050.03812.02
5.3.40.0050.03812.02
5.3.30.0050.03611.98
5.3.20.0060.03511.76
5.3.10.0060.03311.73
5.3.00.0070.03511.71
5.2.170.0040.0319.21
5.2.160.0050.0299.21
5.2.150.0050.0309.21
5.2.140.0050.0329.21
5.2.130.0060.0289.17
5.2.120.0060.0279.18
5.2.110.0090.0259.18
5.2.100.0080.0269.18
5.2.90.0090.0249.18
5.2.80.0070.0319.17
5.2.70.0080.0289.18
5.2.60.0040.0419.13
5.2.50.0040.0319.10
5.2.40.0070.0269.07
5.2.30.0020.0329.05
5.2.20.0030.0319.04
5.2.10.0060.0278.94
5.2.00.0060.0298.80
5.1.60.0050.0238.09
5.1.50.0020.0278.09
5.1.40.0040.0258.07
5.1.30.0070.0248.41
5.1.20.0060.0258.44
5.1.10.0060.0258.16
5.1.00.0040.0258.16
5.0.50.0040.0256.64
5.0.40.0030.0236.50
5.0.30.0050.0306.31
5.0.20.0020.0216.27
5.0.10.0030.0206.26
5.0.00.0050.0296.25
4.4.90.0040.0154.78
4.4.80.0020.0164.75
4.4.70.0050.0134.75
4.4.60.0020.0174.76
4.4.50.0030.0154.77
4.4.40.0040.0244.71
4.4.30.0020.0164.76
4.4.20.0000.0184.84
4.4.10.0010.0174.85
4.4.00.0020.0254.76
4.3.110.0040.0164.67
4.3.100.0020.0244.67
4.3.90.0040.0204.63
4.3.80.0040.0234.58
4.3.70.0010.0164.63
4.3.60.0020.0154.63
4.3.50.0030.0154.63
4.3.40.0020.0254.54
4.3.30.0040.0143.30
4.3.20.0030.0153.28
4.3.10.0030.0153.24
4.3.00.0130.0207.07

preferences:
51.16 ms | 401 KiB | 5 Q