3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Core\Routing { interface Router { public function serve($uri); } class SimpleRouter implements Router { public function serve($uri) { echo 'Serving request: ', $uri, ' using ', __CLASS__; } } class FancyRouter implements Router { public function serve($uri) { echo 'Serving request: ', $uri, ' using ', __CLASS__; } } } namespace Core\Database { interface Connection { public function query($sql); } class MySQLConnection implements Connection { public function query($sql) { echo 'Querying: ', $sql, ' using ', __CLASS__; } } class MariaDBConnection implements Connection { public function query($sql) { echo 'Querying: ', $sql, ' using ', __CLASS__; } } } namespace Core { abstract class Application { protected static $instances = array(); private $properties = array(); public 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 = '\\Core\\Routing\\SimpleRouter'; // TODO: why not use constants here ??? maybe code should be allowed to modify dependencies at runtime ??? protected $databaseConnectionClassName = '\\Core\\Database\\MySQLConnection'; protected function __construct() { $this->router = function ($application) { $routerClassName = $application->routerClassName; return new $routerClassName(); }; $this->databaseConnection = function ($application) { $databaseConnectionClassName = $application->databaseConnectionClassName; return new $databaseConnectionClassName(); }; } } } namespace CompanyName { final class DiscussionsWebApplication extends \Core\WebApplication { protected $routerClassName = '\\Core\\Routing\\FancyRouter'; protected $databaseConnectionClassName = '\\Core\\Database\\MariaDBConnection'; } } namespace { CompanyName\DiscussionsWebApplication::getInstance()->router->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.0070.00716.50
8.3.50.0090.00916.74
8.3.40.0060.00918.88
8.3.30.0110.00418.96
8.3.20.0080.00018.91
8.3.10.0080.00018.73
8.3.00.0060.00319.50
8.2.180.0180.00316.88
8.2.170.0060.01022.96
8.2.160.0070.00721.15
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0070.00026.16
8.2.120.0060.00320.63
8.2.110.0060.00320.97
8.2.100.0090.00317.78
8.2.90.0030.00719.47
8.2.80.0040.00419.39
8.2.70.0090.00017.63
8.2.60.0040.00417.93
8.2.50.0050.00518.07
8.2.40.0080.00018.22
8.2.30.0040.00418.24
8.2.20.0000.00717.74
8.2.10.0000.00817.69
8.2.00.0000.00817.82
8.1.280.0040.01125.92
8.1.270.0070.00024.66
8.1.260.0070.00726.35
8.1.250.0070.00728.09
8.1.240.0110.00020.80
8.1.230.0070.00420.89
8.1.220.0040.00417.74
8.1.210.0030.00618.89
8.1.200.0080.00417.35
8.1.190.0060.00317.43
8.1.180.0080.00018.10
8.1.170.0040.00418.75
8.1.160.0040.00418.89
8.1.150.0040.00418.62
8.1.140.0000.00717.54
8.1.130.0030.00317.85
8.1.120.0000.00717.48
8.1.110.0070.00017.38
8.1.100.0000.00717.52
8.1.90.0050.00217.50
8.1.80.0040.00317.48
8.1.70.0030.00617.45
8.1.60.0000.00817.64
8.1.50.0040.00417.48
8.1.40.0030.00517.45
8.1.30.0040.00417.57
8.1.20.0040.00417.51
8.1.10.0030.00517.57
8.1.00.0040.00417.54
8.0.300.0040.00419.84
8.0.290.0040.00416.58
8.0.280.0000.00718.34
8.0.270.0030.00317.21
8.0.260.0060.00016.84
8.0.250.0050.00316.97
8.0.240.0050.00216.85
8.0.230.0030.00316.86
8.0.220.0000.00716.80
8.0.210.0000.00716.87
8.0.200.0040.00416.99
8.0.190.0060.00316.98
8.0.180.0100.00016.91
8.0.170.0050.00316.89
8.0.160.0050.00316.87
8.0.150.0080.00016.90
8.0.140.0000.01016.88
8.0.130.0000.00613.37
8.0.120.0050.00216.87
8.0.110.0040.00416.84
8.0.100.0040.00416.79
8.0.90.0000.00816.74
8.0.80.0040.01216.95
8.0.70.0050.00316.91
8.0.60.0040.00416.78
8.0.50.0040.00416.92
8.0.30.0120.01316.79
8.0.20.0070.01617.13
8.0.10.0040.00417.07
8.0.00.0130.01016.78
7.4.330.0000.00512.95
7.4.320.0030.00316.63
7.4.300.0000.00716.50
7.4.290.0090.00016.55
7.4.280.0040.00416.52
7.4.270.0080.00016.43
7.4.260.0000.00513.30
7.4.250.0040.00416.60
7.4.240.0020.00516.64
7.4.230.0030.00316.32
7.4.220.0190.00616.48
7.4.210.0070.01216.59
7.4.200.0070.00016.43
7.4.190.0050.00316.38
7.4.160.0130.00316.61
7.4.150.0110.00816.70
7.4.140.0080.00916.46
7.4.130.0070.01016.53
7.4.120.0070.01216.49
7.4.110.0090.01516.52
7.4.100.0060.01216.31
7.4.90.0100.01316.54
7.4.80.0090.00916.32
7.4.70.0140.00316.47
7.4.60.0100.00616.57
7.4.50.0020.01016.34
7.4.40.0080.00816.56
7.4.30.0150.00316.68
7.4.00.0060.00814.93
7.3.330.0030.00313.28
7.3.320.0000.00613.43
7.3.310.0040.00416.36
7.3.300.0000.00716.40
7.3.290.0100.01016.36
7.3.280.0100.00516.37
7.3.270.0110.00816.35
7.3.260.0060.01016.39
7.3.250.0100.00816.54
7.3.240.0100.00716.37
7.3.230.0060.01216.39
7.3.210.0060.01116.55
7.3.200.0110.01119.39
7.3.190.0100.00716.35
7.3.180.0110.00916.21
7.3.170.0060.01316.47
7.3.160.0100.00616.52
7.3.120.0110.00314.86
7.3.00.0070.00716.74
7.2.330.0070.01116.86
7.2.320.0070.01016.89
7.2.310.0110.01116.48
7.2.300.0070.01516.81
7.2.290.0090.00616.74
7.2.130.0100.00816.93
7.2.120.0030.00916.90
7.2.110.0080.00416.84
7.2.100.0100.00716.98
7.2.90.0030.01017.14
7.2.80.0090.00616.99
7.2.70.0070.00716.95
7.2.60.0110.00416.89
7.2.50.0000.01217.03
7.2.40.0060.00617.08
7.2.30.0030.00816.81
7.2.20.0060.00616.66
7.2.10.0030.01016.99
7.2.00.0080.00718.19
7.1.250.0130.00015.68
7.1.240.0080.00415.77
7.1.230.0070.00715.42
7.1.220.0000.01515.75
7.1.210.0000.01415.88
7.1.200.0030.00615.85
7.1.190.0000.01315.79
7.1.180.0070.00715.75
7.1.170.0060.00615.90
7.1.160.0070.00715.96
7.1.150.0000.01415.91
7.1.140.0050.00515.60
7.1.130.0030.00615.63
7.1.120.0100.00315.53
7.1.110.0000.00915.98
7.1.100.0050.01116.91
7.1.90.0080.00315.91
7.1.80.0040.00715.72
7.1.70.0040.00916.53
7.1.60.0060.00917.54
7.1.50.0070.01116.36
7.1.40.0060.00615.81
7.1.30.0050.01215.79
7.1.20.0000.01415.86
7.1.10.0000.01115.78
7.1.00.0040.02619.06
7.0.330.0110.00015.20
7.0.320.0000.00815.29
7.0.310.0060.00615.31
7.0.300.0090.00315.38
7.0.290.0060.00615.39
7.0.280.0070.00415.08
7.0.270.0060.00315.11
7.0.260.0070.00715.25
7.0.250.0040.00815.42
7.0.240.0060.00615.39
7.0.230.0030.01015.54
7.0.220.0070.00715.14
7.0.210.0000.00715.43
7.0.200.0060.00516.02
7.0.190.0030.01015.34
7.0.180.0060.00615.41
7.0.170.0070.00715.51
7.0.160.0070.00315.50
7.0.150.0030.01315.27
7.0.140.0050.04018.69
7.0.130.0040.01115.41
7.0.120.0020.02018.65
7.0.110.0070.00715.14
7.0.100.0070.00415.23
7.0.90.0070.00315.38
7.0.80.0060.00615.32
7.0.70.0050.00315.33
7.0.60.0000.04917.60
7.0.50.0050.04716.38
7.0.40.0070.04515.41
7.0.30.0060.02515.43
7.0.20.0070.03615.47
7.0.10.0060.02015.60
7.0.00.0080.02215.66
5.6.380.0070.00714.46
5.6.370.0030.00714.38
5.6.360.0040.01114.15
5.6.350.0040.00414.43
5.6.340.0100.00314.08
5.6.330.0110.00414.35
5.6.320.0080.00414.29
5.6.310.0080.00414.40
5.6.300.0040.01114.45
5.6.290.0000.01614.45
5.6.280.0040.00714.26
5.6.270.0030.01014.17
5.6.260.0030.01114.35
5.6.250.0080.00414.38
5.6.240.0060.00914.21
5.6.230.0060.00614.27
5.6.220.0060.00614.29
5.6.210.0120.03817.43
5.6.200.0150.02816.25
5.6.190.0070.03316.13
5.6.180.0080.04716.31
5.6.170.0050.03016.43
5.6.160.0080.03716.28
5.6.150.0030.03116.39
5.6.140.0070.02816.36
5.6.130.0030.02916.30
5.6.120.0100.04016.34
5.6.110.0020.03216.32
5.6.100.0050.04216.25
5.6.90.0030.03916.16
5.6.80.0070.04016.08
5.6.70.0070.04015.99
5.6.60.0100.02215.96
5.6.50.0090.03815.96
5.6.40.0090.03015.91
5.6.30.0070.04016.02
5.6.20.0060.02415.77
5.6.10.0020.04715.91
5.6.00.0070.03715.90
5.5.380.0040.00411.12
5.5.370.0060.00311.11
5.5.360.0030.00710.97
5.5.350.0120.02315.93
5.5.340.0050.03514.63
5.5.330.0070.03514.54
5.5.320.0060.04714.47
5.5.310.0040.02414.51
5.5.300.0030.04414.61
5.5.290.0050.03114.60
5.5.280.0070.04314.72
5.5.270.0090.03514.65
5.5.260.0070.03714.61
5.5.250.0000.04614.65
5.5.240.0050.03814.14
5.5.230.0080.02614.15
5.5.220.0070.04214.23
5.5.210.0030.04314.28
5.5.200.0060.04014.34
5.5.190.0050.03814.29
5.5.180.0070.04314.26
5.5.170.0030.00611.25
5.5.160.0070.02214.27
5.5.150.0050.02214.12
5.5.140.0060.02014.25
5.5.130.0030.04714.23
5.5.120.0060.02114.49
5.5.110.0070.04314.29
5.5.100.0110.03314.22
5.5.90.0030.02514.42
5.5.80.0100.03814.14
5.5.70.0060.02514.16
5.5.60.0030.03114.20
5.5.50.0030.04214.32
5.5.40.0080.04014.13
5.5.30.0070.01714.19
5.5.20.0030.02014.05
5.5.10.0020.03814.32
5.5.00.0080.03814.27
5.4.450.0060.03915.22
5.4.440.0030.02515.32
5.4.430.0030.02815.20
5.4.420.0020.03615.28
5.4.410.0080.03715.10
5.4.400.0070.03315.06
5.4.390.0020.02614.99
5.4.380.0070.03715.13
5.4.370.0080.02615.20
5.4.360.0070.02015.05
5.4.350.0050.04315.04
5.4.340.0110.03515.07
5.4.330.0030.00911.01
5.4.320.0090.03314.93
5.4.310.0030.03515.14
5.4.300.0070.02314.89
5.4.290.0020.02315.26
5.4.280.0030.02215.13
5.4.270.0080.04115.09
5.4.260.0070.03515.08
5.4.250.0060.02915.08
5.4.240.0150.01315.13
5.4.230.0030.04515.06
5.4.220.0140.03215.04
5.4.210.0130.03414.96
5.4.200.0040.03114.97
5.4.190.0020.02415.04
5.4.180.0020.02314.93
5.4.170.0050.04515.13
5.4.160.0070.02215.10
5.4.150.0070.02215.11
5.4.140.0050.02513.91
5.4.130.0020.02713.79
5.4.120.0050.03713.79
5.4.110.0050.02013.88
5.4.100.0070.01813.72
5.4.90.0040.02813.72
5.4.80.0070.03413.73
5.4.70.0080.03313.75
5.4.60.0080.03313.70
5.4.50.0030.03213.76
5.4.40.0070.04113.83
5.4.30.0030.04213.73
5.4.20.0050.03313.87
5.4.10.0030.03913.78
5.4.00.0060.04013.55
5.3.290.0050.02112.82
5.3.280.0070.04312.87
5.3.270.0050.02212.80
5.3.260.0050.02212.79
5.3.250.0030.02312.82
5.3.240.0030.03812.75
5.3.230.0050.02812.79
5.3.220.0030.04112.75
5.3.210.0080.03112.77
5.3.200.0090.01712.77
5.3.190.0030.04312.75
5.3.180.0020.03912.77
5.3.170.0000.03212.77
5.3.160.0060.03812.81
5.3.150.0060.03812.75
5.3.140.0080.03312.80
5.3.130.0040.03412.76
5.3.120.0060.04212.77
5.3.110.0060.04012.85
5.3.100.0060.03812.60
5.3.90.0060.04012.49
5.3.80.0020.04112.49
5.3.70.0050.03812.42
5.3.60.0050.02012.47
5.3.50.0080.03412.39
5.3.40.0050.04012.46
5.3.30.0060.03712.45
5.3.20.0070.03812.31
5.3.10.0100.03212.31
5.3.00.0060.02512.32
5.2.170.0030.03311.06
5.2.160.0020.03811.06
5.2.150.0050.03311.09
5.2.140.0070.03011.06
5.2.130.0080.02811.06
5.2.120.0020.02011.06
5.2.110.0020.03311.06
5.2.100.0030.01811.06
5.2.90.0030.02211.06
5.2.80.0050.02111.06
5.2.70.0020.03611.07
5.2.60.0030.02711.06
5.2.50.0050.03011.06
5.2.40.0090.01511.06
5.2.30.0060.03511.06
5.2.20.0060.01511.06
5.2.10.0070.02311.06
5.2.00.0030.03511.06
5.1.60.0030.01511.06
5.1.50.0000.01611.06
5.1.40.0020.01411.06
5.1.30.0030.01311.06
5.1.20.0030.01311.06
5.1.10.0020.01311.06
5.1.00.0070.01511.06
5.0.50.0010.01111.06
5.0.40.0020.01211.06
5.0.30.0020.01811.06
5.0.20.0040.01011.06
5.0.10.0040.00811.06
5.0.00.0040.01511.06
4.4.90.0060.00911.06
4.4.80.0040.00811.06
4.4.70.0030.01711.06
4.4.60.0020.01211.06
4.4.50.0030.01811.06
4.4.40.0000.01611.06
4.4.30.0000.01011.06
4.4.20.0020.00811.06
4.4.10.0020.00811.06
4.4.00.0020.01211.06
4.3.110.0010.00911.06
4.3.100.0000.01011.06
4.3.90.0020.00911.06
4.3.80.0000.01411.06
4.3.70.0030.00711.06
4.3.60.0020.00711.06
4.3.50.0030.00611.06
4.3.40.0000.01411.06
4.3.30.0000.00911.06
4.3.20.0000.01111.06
4.3.10.0000.00911.06
4.3.00.0020.00711.06

preferences:
47.62 ms | 401 KiB | 5 Q