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(); private static function getInstance() { return isset(self::$instances[$className = get_called_class()]) ? self::$instances[$className] : self::$instances[$className] = new static(); } private 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'; private 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.0090.00618.43
8.3.50.0110.00821.15
8.3.40.0200.00018.88
8.3.30.0040.01120.20
8.3.20.0000.00820.16
8.3.10.0040.00421.92
8.3.00.0040.00422.39
8.2.180.0070.00716.63
8.2.170.0130.00722.96
8.2.160.0070.00722.08
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0060.01326.16
8.2.120.0000.00820.84
8.2.110.0090.00021.07
8.2.100.0100.00717.97
8.2.90.0040.00419.31
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0040.00417.90
8.2.50.0000.00818.10
8.2.40.0080.00018.22
8.2.30.0060.00319.36
8.2.20.0000.00717.77
8.2.10.0000.00817.85
8.2.00.0070.00017.84
8.1.280.0150.00025.92
8.1.270.0040.00423.99
8.1.260.0000.00726.35
8.1.250.0050.00328.09
8.1.240.0060.00322.74
8.1.230.0040.00717.83
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0070.00317.35
8.1.190.0040.00417.23
8.1.180.0000.00818.10
8.1.170.0050.00318.58
8.1.160.0000.00718.75
8.1.150.0040.00418.63
8.1.140.0040.00417.36
8.1.130.0050.00317.86
8.1.120.0070.00017.37
8.1.110.0000.00717.32
8.1.100.0040.00417.50
8.1.90.0000.00717.46
8.1.80.0040.00417.32
8.1.70.0030.00317.43
8.1.60.0030.00517.57
8.1.50.0040.00417.41
8.1.40.0040.00417.39
8.1.30.0050.00217.63
8.1.20.0030.00617.53
8.1.10.0050.00317.60
8.1.00.0040.00417.38
8.0.300.0060.00318.77
8.0.290.0070.00017.00
8.0.280.0000.00718.46
8.0.270.0040.00417.30
8.0.260.0030.00316.93
8.0.250.0030.00317.02
8.0.240.0000.00816.89
8.0.230.0000.00716.96
8.0.220.0070.00016.94
8.0.210.0070.00016.93
8.0.200.0000.00717.09
8.0.190.0070.00016.97
8.0.180.0030.00516.92
8.0.170.0000.00816.92
8.0.160.0030.00516.89
8.0.150.0080.00017.00
8.0.140.0000.00717.01
8.0.130.0000.00813.36
8.0.120.0080.00017.01
8.0.110.0040.00416.92
8.0.100.0040.00416.87
8.0.90.0050.00217.04
8.0.80.0060.01316.96
8.0.70.0030.00517.04
8.0.60.0080.00016.99
8.0.50.0000.00817.06
8.0.30.0120.00617.20
8.0.20.0130.00517.40
8.0.10.0070.00016.87
8.0.00.0070.01216.74
7.4.330.0000.00515.00
7.4.320.0030.00316.47
7.4.300.0000.00716.46
7.4.290.0040.00416.69
7.4.280.0040.00416.55
7.4.270.0040.00416.53
7.4.260.0050.00013.26
7.4.250.0000.00716.65
7.4.240.0020.00516.55
7.4.230.0040.00416.69
7.4.220.0100.01016.45
7.4.210.0090.00916.56
7.4.200.0000.00716.59
7.4.190.0050.00216.36
7.4.160.0090.00616.35
7.4.150.0090.01217.40
7.4.140.0070.01317.86
7.4.130.0080.01116.46
7.4.120.0090.00816.53
7.4.110.0100.00716.85
7.4.100.0030.01416.43
7.4.90.0120.00916.49
7.4.80.0110.01119.39
7.4.70.0070.01316.50
7.4.60.0070.01016.58
7.4.50.0040.00416.64
7.4.40.0030.01222.77
7.4.30.0150.00616.62
7.4.00.0090.00615.18
7.3.330.0000.00513.26
7.3.320.0030.00313.25
7.3.310.0040.00416.45
7.3.300.0000.00716.25
7.3.290.0000.01416.41
7.3.280.0130.00716.37
7.3.270.0030.01317.40
7.3.260.0170.00016.56
7.3.250.0150.00616.62
7.3.240.0070.01016.37
7.3.230.0060.01216.39
7.3.210.0060.01016.34
7.3.200.0100.00719.39
7.3.190.0120.00916.38
7.3.180.0060.01016.46
7.3.170.0080.00816.61
7.3.160.0060.00916.50
7.3.120.0000.01614.88
7.2.330.0160.00316.42
7.2.320.0110.00816.61
7.2.310.0130.00316.38
7.2.300.0100.00616.73
7.2.290.0070.01116.61
7.2.60.0000.01616.86
7.2.00.0030.00618.96
7.1.200.0050.01115.60
7.1.100.0000.01118.21
7.1.70.0040.00417.20
7.1.60.0070.01819.32
7.1.50.0130.00934.84
7.1.00.0000.05722.48
7.0.200.0000.00816.72
7.0.140.0100.06322.08
7.0.100.0100.06719.93
7.0.90.0100.08019.95
7.0.80.0070.05719.94
7.0.70.0170.07320.03
7.0.60.0070.07319.88
7.0.50.0130.07720.28
7.0.40.0170.04720.09
7.0.30.0100.07320.07
7.0.20.0130.04320.07
7.0.10.0170.07020.08
7.0.00.0100.04719.93
5.6.280.0030.07321.10
5.6.250.0170.07720.59
5.6.240.0030.07020.72
5.6.230.0200.06720.68
5.6.220.0200.03720.64
5.6.210.0100.07720.48
5.6.200.0000.08321.07
5.6.190.0130.07020.97
5.6.180.0200.07021.12
5.6.170.0070.04721.06
5.6.160.0100.08021.19
5.6.150.0070.08021.09
5.6.140.0070.06021.10
5.6.130.0070.04721.18
5.6.120.0070.08320.95
5.6.110.0130.07721.11
5.6.100.0030.05321.17
5.6.90.0070.05321.01
5.6.80.0100.05020.42
5.6.70.0030.06020.40
5.6.60.0030.04720.43
5.6.50.0070.08320.48
5.6.40.0030.05020.43
5.6.30.0030.07720.35
5.6.20.0030.08320.46
5.6.10.0100.06320.40
5.6.00.0030.07720.39
5.5.380.0070.08320.43
5.5.370.0030.08320.59
5.5.360.0030.05020.41
5.5.350.0100.08020.48
5.5.340.0100.07720.77
5.5.330.0030.05320.79
5.5.320.0070.06320.82
5.5.310.0170.04020.74
5.5.300.0100.04020.91
5.5.290.0030.06020.90
5.5.280.0030.06020.80
5.5.270.0200.06320.76
5.5.260.0130.07020.91
5.5.250.0070.06020.59
5.5.240.0030.07020.04
5.5.230.0070.05020.31
5.5.220.0200.06720.12
5.5.210.0100.07020.32
5.5.200.0100.07320.14
5.5.190.0070.08020.19
5.5.180.0130.07720.09
5.5.160.0070.07720.23
5.5.150.0070.08320.25
5.5.140.0130.06720.26
5.5.130.0100.07320.23
5.5.120.0030.04320.11
5.5.110.0100.07020.09
5.5.100.0100.07320.11
5.5.90.0100.07320.09
5.5.80.0100.07719.93
5.5.70.0100.07719.95
5.5.60.0130.06020.13
5.5.50.0030.08320.11
5.5.40.0100.07319.97
5.5.30.0030.08720.07
5.5.20.0070.06720.08
5.5.10.0100.07320.02
5.5.00.0130.06720.04
5.4.450.0100.07719.33
5.4.440.0070.08319.22
5.4.430.0100.06719.17
5.4.420.0070.07719.45
5.4.410.0170.07019.40
5.4.400.0030.04719.18
5.4.390.0030.05718.90
5.4.380.0170.06319.12
5.4.370.0000.08319.16
5.4.360.0170.05318.90
5.4.350.0000.05718.94
5.4.340.0100.07718.90
5.4.320.0130.04319.13
5.4.310.0100.06319.04
5.4.300.0030.08019.04
5.4.290.0070.06019.23
5.4.280.0030.07718.88
5.4.270.0070.04719.13
5.4.260.0130.06019.18
5.4.250.0030.08019.03
5.4.240.0030.05318.84
5.4.230.0070.04019.16
5.4.220.0100.07319.03
5.4.210.0130.07018.89
5.4.200.0070.08019.04
5.4.190.0130.06719.11
5.4.180.0070.08018.86
5.4.170.0100.06719.02
5.4.160.0130.07019.07
5.4.150.0100.07319.18
5.4.140.0100.04016.42
5.4.130.0100.06316.39
5.4.120.0170.04016.41
5.4.110.0130.04716.37
5.4.100.0130.06716.38
5.4.90.0030.07716.53
5.4.80.0030.08016.36
5.4.70.0100.05716.31
5.4.60.0070.07316.31
5.4.50.0100.04016.45
5.4.40.0070.07316.37
5.4.30.0070.06316.38
5.4.20.0100.03716.48
5.4.10.0130.06016.48
5.4.00.0100.04015.82
5.3.290.0070.08314.73
5.3.280.0070.05714.64
5.3.270.0070.06314.75
5.3.260.0130.04014.69
5.3.250.0070.08014.67
5.3.240.0070.04714.69
5.3.230.0030.06014.68
5.3.220.0100.07314.68
5.3.210.0030.07714.53
5.3.200.0070.05714.55
5.3.190.0030.07314.63
5.3.180.0030.08014.66
5.3.170.0030.08014.63
5.3.160.0130.03014.53
5.3.150.0030.08314.54
5.3.140.0030.04314.59
5.3.130.0130.07314.59
5.3.120.0070.06714.61
5.3.110.0100.07014.57
5.3.100.0070.07014.13
5.3.90.0100.08014.11
5.3.80.0100.04314.08
5.3.70.0030.07314.07
5.3.60.0070.04014.09
5.3.50.0000.06713.91
5.3.40.0070.04013.97
5.3.30.0000.08313.91
5.3.20.0030.04313.71
5.3.10.0100.03713.69
5.3.00.0070.04013.72
5.2.170.0030.06311.16
5.2.160.0070.06311.26
5.2.150.0030.05711.04
5.2.140.0100.05711.21
5.2.130.0070.06011.12
5.2.120.0100.05711.10
5.2.110.0030.05711.17
5.2.100.0070.05711.16
5.2.90.0030.04311.17
5.2.80.0070.04311.09
5.2.70.0030.06310.96
5.2.60.0070.04311.14
5.2.50.0000.06711.05
5.2.40.0070.06011.03
5.2.30.0030.05010.99
5.2.20.0130.05311.02
5.2.10.0030.05310.80
5.2.00.0070.04710.64
5.1.60.0130.03010.04
5.1.50.0030.04710.00
5.1.40.0030.05310.11
5.1.30.0000.04010.28
5.1.20.0000.04310.36
5.1.10.0030.0439.93
5.1.00.0000.04010.20
5.0.50.0130.0338.63
5.0.40.0000.0278.43
5.0.30.0030.0638.35
5.0.20.0030.0278.30
5.0.10.0030.0378.15
5.0.00.0130.0508.16
4.4.90.0070.0338.15
4.4.80.0100.0308.15
4.4.70.0030.0208.15
4.4.60.0030.0308.15
4.4.50.0000.0338.15
4.4.40.0070.0278.15
4.4.30.0030.0178.15
4.4.20.0030.0278.15
4.4.10.0000.0208.15
4.4.00.0000.0408.15
4.3.110.0070.0208.15
4.3.100.0000.0378.15
4.3.90.0030.0378.15
4.3.80.0000.0578.15
4.3.70.0000.0178.15
4.3.60.0030.0178.15
4.3.50.0030.0178.15
4.3.40.0000.0538.15
4.3.30.0030.0178.15
4.3.20.0000.0238.15
4.3.10.0000.0238.15
4.3.00.0000.0178.15

preferences:
50.84 ms | 401 KiB | 5 Q