3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Router { public function serve($uri); } class FlatRouter implements Router { public function serve($uri) { // send()s instance of HTTP\Request, no return value echo 'Serving request: ', $uri, ' using ', __CLASS__; } } class NestedRouter implements Router { public function serve($uri) { // send()s instance of HTTP\Request, no return value echo 'Serving request: ', $uri, ' using ', __CLASS__; } } abstract class Application { protected static $instances = array(); private $properties = array(); protected static function getInstance() { return isset(self::$instances[$className = get_called_class()]) ? self::$instances[$className] : self::$instances[$className] = new static(); } protected function __construct() { } public function __set($propertyName, $value) { $this->properties[$propertyName] = $value; } public function __get($propertyName) { return is_callable($this->properties[$propertyName]) ? $this->properties[$propertyName] = $this->properties[$propertyName]($this) : $this->properties[$propertyName]; } } abstract class WebApplication extends Application { protected $routerClassName = 'FlatRouter'; protected function __construct() { $this->router = function ($application) { $routerClassName = $application->routerClassName; return new $routerClassName(); }; } public static function serve($uri) { $instance = static::getInstance(); $instance->router->serve($uri); } } final class FooBarWebApplication extends WebApplication { protected $routerClassName = 'NestedRouter'; } FooBarWebApplication::serve('http://foo.bar/path/to/resource');

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.0060.00918.61
8.3.50.0120.00721.14
8.3.40.0120.00318.93
8.3.30.0040.01220.39
8.3.20.0030.00620.24
8.3.10.0000.00822.03
8.3.00.0040.00422.39
8.2.180.0040.01216.63
8.2.170.0070.00722.96
8.2.160.0060.00922.11
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00821.04
8.2.110.0030.00619.27
8.2.100.0060.00617.78
8.2.90.0040.00417.75
8.2.80.0050.00317.97
8.2.70.0030.00618.00
8.2.60.0000.00818.03
8.2.50.0090.00018.10
8.2.40.0030.00520.60
8.2.30.0060.00319.46
8.2.20.0000.00717.66
8.2.10.0030.00517.66
8.2.00.0000.00717.70
8.1.280.0110.00325.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0070.00322.51
8.1.230.0060.00620.89
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0000.00917.22
8.1.190.0060.00617.22
8.1.180.0080.00018.10
8.1.170.0040.00418.59
8.1.160.0000.00720.59
8.1.150.0040.00418.69
8.1.140.0080.00017.57
8.1.130.0040.00417.91
8.1.120.0080.00017.35
8.1.110.0030.00517.49
8.1.100.0040.00417.52
8.1.90.0040.00417.49
8.1.80.0040.00417.50
8.1.70.0070.00017.48
8.1.60.0000.00817.66
8.1.50.0040.00417.58
8.1.40.0040.00417.62
8.1.30.0000.00917.73
8.1.20.0060.00317.66
8.1.10.0040.00417.63
8.1.00.0030.00517.47
8.0.300.0040.00421.50
8.0.290.0040.00416.58
8.0.280.0040.00418.45
8.0.270.0000.00717.23
8.0.260.0070.00016.87
8.0.250.0000.00816.88
8.0.240.0050.00316.98
8.0.230.0000.00716.97
8.0.220.0040.00416.93
8.0.210.0030.00316.96
8.0.200.0070.00017.04
8.0.190.0020.00516.91
8.0.180.0000.00816.85
8.0.170.0000.00717.03
8.0.160.0000.00716.91
8.0.150.0070.00016.80
8.0.140.0070.00016.86
8.0.130.0040.00413.44
8.0.120.0050.00216.93
8.0.110.0050.00316.89
8.0.100.0000.00716.73
8.0.90.0040.00416.76
8.0.80.0070.01016.93
8.0.70.0000.00716.77
8.0.60.0040.00416.73
8.0.50.0000.00716.93
8.0.30.0140.00717.17
8.0.20.0090.01117.40
8.0.10.0000.00816.95
8.0.00.0130.00916.81
7.4.330.0000.00515.00
7.4.320.0030.00316.65
7.4.300.0030.00316.40
7.4.290.0050.00216.57
7.4.280.0000.00716.54
7.4.270.0000.00816.55
7.4.260.0050.00013.25
7.4.250.0040.00416.54
7.4.240.0030.00516.56
7.4.230.0040.00416.45
7.4.220.0090.00916.56
7.4.210.0110.00616.56
7.4.200.0030.00516.52
7.4.190.0070.00016.52
7.4.160.0100.00716.52
7.4.150.0100.00717.40
7.4.140.0140.00517.86
7.4.130.0110.00616.55
7.4.120.0130.00816.59
7.4.110.0100.00716.56
7.4.100.0100.00716.53
7.4.90.0090.00916.71
7.4.80.0120.00619.39
7.4.70.0060.01316.49
7.4.60.0090.00916.41
7.4.50.0060.00316.64
7.4.40.0060.00922.77
7.4.30.0060.01116.63
7.4.10.0110.00814.92
7.4.00.0060.01014.82
7.3.330.0000.00513.27
7.3.320.0000.00513.39
7.3.310.0020.00516.22
7.3.300.0070.00016.27
7.3.290.0070.00716.45
7.3.280.0100.00616.39
7.3.270.0100.00717.40
7.3.260.0100.00716.55
7.3.250.0130.00716.55
7.3.240.0030.01716.35
7.3.230.0060.01016.66
7.3.210.0040.01816.71
7.3.200.0090.01319.39
7.3.190.0040.01916.39
7.3.180.0060.01016.55
7.3.170.0030.01216.38
7.3.160.0100.00616.56
7.3.130.0040.01214.92
7.3.120.0080.00814.84
7.3.110.0070.01014.93
7.3.100.0070.00914.79
7.3.90.0070.00714.84
7.3.80.0040.00714.80
7.3.70.0050.00814.80
7.3.60.0070.00814.79
7.3.50.0040.01014.90
7.3.40.0050.01214.90
7.3.30.0080.00614.87
7.3.20.0070.00916.68
7.3.10.0050.00916.49
7.3.00.0070.00916.66
7.2.330.0090.00916.70
7.2.320.0130.01016.88
7.2.310.0090.00916.38
7.2.300.0140.00316.73
7.2.290.0100.00716.86
7.2.260.0070.01014.97
7.2.250.0090.00715.12
7.2.240.0050.00815.20
7.2.230.0070.00814.95
7.2.220.0030.01515.12
7.2.210.0050.01215.00
7.2.200.0060.00615.05
7.2.190.0050.01115.20
7.2.180.0100.00615.04
7.2.170.0050.01015.04
7.2.160.0000.01515.06
7.2.150.0030.01316.96
7.2.140.0000.01116.79
7.2.130.0110.00416.97
7.2.120.0000.01516.84
7.2.110.0080.00416.79
7.2.100.0040.01117.03
7.2.90.0040.01116.66
7.2.80.0070.00716.87
7.2.70.0100.00316.67
7.2.60.0060.00616.93
7.2.50.0150.00317.05
7.2.40.0060.00916.77
7.2.30.0060.00316.94
7.2.20.0060.00317.09
7.2.10.0000.01616.72
7.2.00.0050.00918.22
7.1.330.0020.01215.90
7.1.320.0080.00515.77
7.1.310.0050.01015.80
7.1.300.0100.00615.69
7.1.290.0100.00515.73
7.1.280.0060.00315.82
7.1.270.0040.00815.71
7.1.260.0010.01015.78
7.1.250.0040.01115.84
7.1.240.0000.01115.84
7.1.230.0040.00715.77
7.1.220.0040.01215.79
7.1.210.0150.00015.87
7.1.200.0000.01315.82
7.1.190.0060.00615.70
7.1.180.0070.01015.78
7.1.170.0040.00415.91
7.1.160.0110.00315.97
7.1.150.0060.00615.77
7.1.140.0130.00315.99
7.1.130.0060.00915.84
7.1.120.0040.00815.69
7.1.110.0040.00715.91
7.1.100.0020.01216.90
7.1.90.0030.01015.86
7.1.80.0000.01115.71
7.1.70.0030.00716.42
7.1.60.0090.01017.61
7.1.50.0040.01216.35
7.1.40.0000.01015.86
7.1.30.0000.01415.71
7.1.20.0060.00315.74
7.1.10.0060.00615.89
7.1.00.0060.01819.12
7.0.330.0030.00915.19
7.0.320.0040.01215.39
7.0.310.0110.00015.50
7.0.300.0050.00515.57
7.0.290.0130.00015.57
7.0.280.0100.00315.64
7.0.270.0030.01215.43
7.0.260.0030.01015.53
7.0.250.0000.01515.62
7.0.240.0070.00715.28
7.0.230.0090.00615.39
7.0.220.0030.01015.48
7.0.210.0050.00515.37
7.0.200.0050.00516.00
7.0.190.0030.00915.59
7.0.180.0080.00315.49
7.0.170.0000.01515.43
7.0.160.0000.00815.53
7.0.150.0000.01415.42
7.0.140.0020.04318.76
7.0.130.0120.00315.18
7.0.120.0040.01115.12
7.0.110.0000.01215.56
7.0.100.0140.04117.77
7.0.90.0080.05017.71
7.0.80.0120.03917.84
7.0.70.0050.04417.62
7.0.60.0130.04017.76
7.0.50.0110.02017.98
7.0.40.0070.02416.82
7.0.30.0050.02316.82
7.0.20.0070.02316.87
7.0.10.0100.02216.73
7.0.00.0080.02516.86
5.6.400.0060.00614.43
5.6.390.0040.00714.29
5.6.380.0030.01414.35
5.6.370.0040.00714.49
5.6.360.0000.01114.59
5.6.350.0040.00814.28
5.6.340.0000.01314.41
5.6.330.0040.01114.70
5.6.320.0030.01314.46
5.6.310.0030.01014.50
5.6.300.0030.01014.47
5.6.290.0030.01014.42
5.6.280.0060.04017.88
5.6.270.0050.00514.84
5.6.260.0030.00614.40
5.6.250.0050.04817.65
5.6.240.0070.03617.56
5.6.230.0050.04817.65
5.6.220.0040.04417.77
5.6.210.0110.02317.41
5.6.200.0130.03517.83
5.6.190.0030.02817.91
5.6.180.0070.02417.80
5.6.170.0090.02017.80
5.6.160.0050.03717.83
5.6.150.0060.02517.87
5.6.140.0030.02317.77
5.6.130.0060.03917.88
5.6.120.0110.02017.83
5.6.110.0030.02717.68
5.6.100.0070.03117.99
5.6.90.0050.02517.88
5.6.80.0030.02817.41
5.6.70.0070.04717.39
5.6.60.0020.02517.37
5.6.50.0010.02817.46
5.6.40.0030.02317.55
5.6.30.0070.02117.58
5.6.20.0020.03217.49
5.6.10.0050.02217.41
5.6.00.0040.02317.38
5.5.380.0060.02617.59
5.5.370.0080.05017.35
5.5.360.0040.04717.32
5.5.350.0030.04617.42
5.5.340.0060.03017.71
5.5.330.0080.02617.76
5.5.320.0050.02717.69
5.5.310.0050.02317.63
5.5.300.0030.02317.75
5.5.290.0100.02817.75
5.5.280.0070.02317.57
5.5.270.0120.02217.64
5.5.260.0030.02717.51
5.5.250.0080.04217.51
5.5.240.0080.02117.36
5.5.230.0050.03017.37
5.5.220.0020.02717.44
5.5.210.0040.02217.34
5.5.200.0050.02217.33
5.5.190.0050.02617.23
5.5.180.0060.02417.39
5.5.170.0040.01114.49
5.5.160.0050.02317.37
5.5.150.0050.02217.41
5.5.140.0030.02717.31
5.5.130.0030.02817.22
5.5.120.0050.02317.29
5.5.110.0040.03517.36
5.5.100.0030.02317.20
5.5.90.0100.01717.12
5.5.80.0060.02217.08
5.5.70.0080.04217.28
5.5.60.0080.04217.37
5.5.50.0070.03817.29
5.5.40.0070.04017.33
5.5.30.0100.02917.21
5.5.20.0030.04317.17
5.5.10.0090.04017.14
5.5.00.0050.04417.16
5.4.450.0030.02215.55
5.4.440.0020.02715.47
5.4.430.0040.02315.50
5.4.420.0020.02315.54
5.4.410.0030.02215.57
5.4.400.0060.03115.32
5.4.390.0030.03215.38
5.4.380.0050.03715.45
5.4.370.0040.02115.39
5.4.360.0070.01815.31
5.4.350.0030.02315.46
5.4.340.0020.02515.45
5.4.330.0080.00311.74
5.4.320.0000.02315.38
5.4.310.0030.02215.31
5.4.300.0060.01815.32
5.4.290.0030.02315.37
5.4.280.0030.02815.43
5.4.270.0030.02515.44
5.4.260.0030.02315.41
5.4.250.0070.02015.42
5.4.240.0020.04115.39
5.4.230.0030.03815.34
5.4.220.0140.03715.29
5.4.210.0020.04615.43
5.4.200.0000.03115.43
5.4.190.0070.04015.48
5.4.180.0070.04315.50
5.4.170.0080.02215.38
5.4.160.0030.02815.39
5.4.150.0070.04015.31
5.4.140.0100.03514.12
5.4.130.0100.03514.11
5.4.120.0060.04013.99
5.4.110.0070.02414.14
5.4.100.0060.04014.07
5.4.90.0050.02014.11
5.4.80.0030.03814.15
5.4.70.0000.04514.10
5.4.60.0020.04314.04
5.4.50.0050.03214.00
5.4.40.0110.02414.07
5.4.30.0120.03214.11
5.4.20.0030.03714.06
5.4.10.0070.03414.10
5.4.00.0100.04013.80
5.3.290.0050.02113.23
5.3.280.0030.04313.20
5.3.270.0070.04113.21
5.3.260.0030.02813.20
5.3.250.0100.03813.20
5.3.240.0030.03013.18
5.3.230.0100.02313.20
5.3.220.0090.03413.17
5.3.210.0110.03013.16
5.3.200.0080.03813.14
5.3.190.0120.03713.24
5.3.180.0080.03713.24
5.3.170.0060.04013.16
5.3.160.0070.04213.20
5.3.150.0070.02113.14
5.3.140.0020.03213.20
5.3.130.0050.02313.16
5.3.120.0060.03813.16
5.3.110.0050.02913.19
5.3.100.0050.02412.98
5.3.90.0060.03812.90
5.3.80.0020.03912.91
5.3.70.0050.04112.85
5.3.60.0030.02912.85
5.3.50.0070.03712.92
5.3.40.0070.03912.91
5.3.30.0080.03712.83
5.3.20.0070.02912.75
5.3.10.0080.03012.72
5.3.00.0060.02512.75
5.2.170.0030.06311.09
5.2.160.0030.06311.16
5.2.150.0100.05711.04
5.2.140.0030.06311.14
5.2.130.0100.05311.18
5.2.120.0070.06011.02
5.2.110.0000.03710.99
5.2.100.0030.06311.02
5.2.90.0100.05711.02
5.2.80.0070.06711.25
5.2.70.0130.02711.12
5.2.60.0000.04311.05
5.2.50.0200.04311.10
5.2.40.0070.05011.07
5.2.30.0000.04311.01
5.2.20.0030.06311.03
5.2.10.0130.04010.90
5.2.00.0000.03310.85
5.1.60.0000.04310.46
5.1.50.0000.05710.46
5.1.40.0000.04710.46
5.1.30.0030.04710.46
5.1.20.0070.03710.46
5.1.10.0030.02710.46
5.1.00.0070.05010.46
5.0.50.0000.04310.46
5.0.40.0000.04710.46
5.0.30.0000.04310.46
5.0.20.0030.03710.46
5.0.10.0070.02310.46
5.0.00.0000.05710.46
4.4.90.0030.02710.46
4.4.80.0030.02310.46
4.4.70.0100.01710.46
4.4.60.0000.03310.46
4.4.50.0000.02310.46
4.4.40.0000.05310.46
4.4.30.0030.03310.46
4.4.20.0000.01710.46
4.4.10.0030.03310.46
4.4.00.0000.03710.46
4.3.110.0030.03310.46
4.3.100.0030.03310.46
4.3.90.0000.03310.46
4.3.80.0030.05310.46
4.3.70.0000.03710.46
4.3.60.0070.03010.46
4.3.50.0000.02710.46
4.3.40.0030.04710.46
4.3.30.0030.01710.46
4.3.20.0000.03710.46
4.3.10.0030.02710.46
4.3.00.0000.02010.46

preferences:
35.38 ms | 401 KiB | 5 Q