3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Request { public function __construct() { echo 'Request created'; } } class DI { protected $shared = []; protected $definitions = []; public function __construct() {} public function set($name, $definition, $shared = false) { if($shared) { if(isset($shared[$name])) { throw new Exception("Definition '$name' is already set. Use DI::remove('$name') to remove it."); } $this->shared[$name] = $definition; } else { if(isset($definitions[$name])) { throw new Exception("Definition '$name' is already set. Use DI::remove('$name') to remove it."); } $this->definitions[$name] = $definition; } } public function getRaw($name) { if(!isset($this->definitions[$name])) { throw new Exception("Definition '$name' is not set. Use DI::set('$name', <definition>, <shared>) to set it."); } return $this->definitions[$name]; } public function get($name) { $definition = $this->getRaw($name); return $definition(); } } $di = new DI(); //Using an anonymous function $di->set('request', function(){ return new Request(); }); var_dump($di->get('request'));

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.0100.00718.52
8.3.50.0110.00821.16
8.3.40.0070.00718.97
8.3.30.0110.00319.04
8.3.20.0040.00420.29
8.3.10.0070.00021.64
8.3.00.0000.00819.38
8.2.180.0140.00716.88
8.2.170.0150.00018.96
8.2.160.0140.00322.96
8.2.150.0060.01224.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0080.00022.18
8.2.110.0100.00020.53
8.2.100.0120.00018.16
8.2.90.0080.00019.39
8.2.80.0060.00317.97
8.2.70.0040.00417.50
8.2.60.0000.00918.03
8.2.50.0040.00418.07
8.2.40.0050.00319.95
8.2.30.0040.00418.16
8.2.20.0080.00017.83
8.2.10.0040.00418.22
8.2.00.0050.00317.81
8.1.280.0000.01825.92
8.1.270.0000.00821.94
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00323.77
8.1.230.0090.00319.09
8.1.220.0030.00517.79
8.1.210.0030.00518.77
8.1.200.0060.00317.48
8.1.190.0030.00517.23
8.1.180.0030.00618.10
8.1.170.0000.00918.61
8.1.160.0040.00422.02
8.1.150.0070.00018.95
8.1.140.0070.00017.48
8.1.130.0000.00717.70
8.1.120.0040.00317.41
8.1.110.0000.00817.44
8.1.100.0000.00717.39
8.1.90.0040.00417.50
8.1.80.0070.00217.35
8.1.70.0050.00217.44
8.1.60.0040.00417.58
8.1.50.0060.00317.57
8.1.40.0040.00417.50
8.1.30.0000.00817.66
8.1.20.0040.00417.68
8.1.10.0000.00717.50
8.1.00.0040.00417.50
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0040.00418.48
8.0.270.0030.00317.29
8.0.260.0030.00317.29
8.0.250.0000.00716.87
8.0.240.0050.00216.98
8.0.230.0000.00716.85
8.0.220.0080.00016.91
8.0.210.0000.00716.98
8.0.200.0040.00416.86
8.0.190.0000.00716.97
8.0.180.0000.00716.85
8.0.170.0030.00516.87
8.0.160.0000.00717.06
8.0.150.0040.00416.85
8.0.140.0040.00416.79
8.0.130.0060.00013.35
8.0.120.0000.00716.95
8.0.110.0050.00316.91
8.0.100.0040.00416.79
8.0.90.0040.00416.88
8.0.80.0140.00716.83
8.0.70.0040.00416.99
8.0.60.0040.00416.79
8.0.50.0000.00716.92
8.0.30.0130.00816.89
8.0.20.0170.00717.40
8.0.10.0030.00517.06
8.0.00.0100.00716.81
7.4.330.0060.00015.12
7.4.320.0030.00316.68
7.4.300.0000.00716.63
7.4.290.0070.00016.50
7.4.280.0050.00216.61
7.4.270.0030.00316.66
7.4.260.0040.00416.52
7.4.250.0020.00516.61
7.4.240.0030.00416.59
7.4.230.0030.00516.71
7.4.220.0030.01616.63
7.4.210.0070.00716.52
7.4.200.0070.00016.54
7.4.160.0120.01516.58
7.4.150.0100.00917.40
7.4.140.0120.00917.86
7.4.130.0100.00716.49
7.4.120.0090.00916.44
7.4.110.0030.01316.58
7.4.100.0030.01416.45
7.4.90.0100.00716.77
7.4.80.0030.01919.39
7.4.70.0100.00716.45
7.4.60.0060.00916.75
7.4.50.0000.00816.58
7.4.40.0100.00716.57
7.4.30.0100.00516.65
7.4.00.0070.01014.88
7.3.330.0000.00513.40
7.3.320.0020.00213.27
7.3.310.0030.00316.39
7.3.300.0000.00716.17
7.3.290.0050.01116.39
7.3.280.0110.00616.41
7.3.270.0090.00917.40
7.3.260.0130.01016.62
7.3.250.0140.00416.46
7.3.240.0210.00316.32
7.3.230.0130.00716.71
7.3.210.0100.01016.47
7.3.200.0060.01219.39
7.3.190.0030.01316.63
7.3.180.0120.00416.43
7.3.170.0060.01516.39
7.3.160.0060.01016.61
7.3.120.0030.01015.09
7.3.110.0080.00814.93
7.3.100.0090.00514.79
7.3.90.0010.00914.94
7.3.80.0080.00714.93
7.3.70.0060.00914.81
7.3.60.0070.00914.80
7.3.50.0070.00714.74
7.3.40.0050.00914.96
7.3.30.0040.01014.64
7.3.20.0070.00816.58
7.3.10.0030.01216.55
7.3.00.0070.00516.68
7.2.330.0140.01016.47
7.2.320.0090.01216.47
7.2.310.0080.00916.74
7.2.300.0130.01016.41
7.2.290.0060.01316.67
7.2.250.0120.00615.00
7.2.240.0050.01115.26
7.2.230.0090.00615.26
7.2.220.0040.01114.90
7.2.210.0080.00814.86
7.2.200.0030.00915.04
7.2.190.0020.01415.09
7.2.180.0070.01014.95
7.2.170.0070.01214.98
7.2.160.0060.00915.22
7.2.150.0100.00716.69
7.2.140.0030.01316.97
7.2.130.0090.00916.90
7.2.120.0020.01517.04
7.2.110.0080.00616.70
7.2.100.0030.01216.96
7.2.90.0060.00716.90
7.2.80.0030.01017.05
7.2.70.0070.01016.88
7.2.60.0080.00816.79
7.2.50.0070.00916.87
7.2.40.0080.00816.78
7.2.30.0050.00716.89
7.2.20.0070.01016.72
7.2.10.0090.00616.81
7.2.00.0120.00517.79
7.1.330.0050.00915.81
7.1.320.0040.01115.87
7.1.310.0020.01015.52
7.1.300.0080.00615.85
7.1.290.0020.01215.75
7.1.280.0060.00915.87
7.1.270.0030.01115.66
7.1.260.0000.01615.82
7.1.250.0060.01015.80
7.1.100.0040.00817.98
7.1.70.0030.00717.09
7.1.60.0100.01419.11
7.1.50.0030.02016.96
7.1.00.0070.06722.37
7.0.200.0030.00616.94
7.0.140.0100.06722.00
7.0.60.0230.06719.93
7.0.50.0100.06017.84
7.0.40.0200.07320.27
7.0.30.0330.07720.07
7.0.20.0270.03720.10
7.0.10.0030.08020.08
7.0.00.0070.04720.10
5.6.280.0000.08021.09
5.6.210.0100.06020.70
5.6.200.0130.04318.17
5.6.190.0030.08720.34
5.6.180.3730.04320.41
5.6.170.0270.07720.55
5.6.160.0030.07020.52
5.6.150.0070.08018.27
5.6.140.0100.04018.19
5.6.130.0030.04018.14
5.6.120.0030.08721.01
5.6.110.0100.07721.01
5.6.100.0070.08321.02
5.6.90.0030.08021.14
5.6.80.0070.04020.55
5.6.70.4430.04320.38
5.5.350.0030.06720.35
5.5.340.0130.07318.04
5.5.330.0030.04020.27
5.5.320.3170.03320.27
5.5.310.0300.06320.34
5.5.300.0070.08317.99
5.5.290.0030.04318.04
5.5.280.0170.07720.89
5.5.270.0030.04320.77
5.5.260.0130.07720.80
5.5.250.0070.04020.59
5.5.240.0230.06720.20
5.4.450.0130.05719.48
5.4.440.0200.05719.61
5.4.430.0200.05319.44
5.4.420.0630.00019.39
5.4.410.0730.00019.58
5.4.400.0670.00019.27
5.4.390.0630.00019.24
5.4.380.0630.00019.04
5.4.370.0670.00019.12
5.4.360.0600.00019.07
5.4.350.0700.00019.00
5.4.340.0050.03512.03
5.4.320.0060.04012.52
5.4.310.0060.03812.51
5.4.300.0090.03412.52
5.4.290.0020.04212.51
5.4.280.0070.03312.41
5.4.270.0050.03612.41
5.4.260.0040.03912.41
5.4.250.0050.03812.41
5.4.240.0070.03412.41
5.4.230.0100.04412.40
5.4.220.0060.03612.40
5.4.210.0080.03312.40
5.4.200.0030.04012.41
5.4.190.0060.03512.40
5.4.180.0050.03612.40
5.4.170.0050.03512.41
5.4.160.0030.03812.41
5.4.150.0050.03512.40
5.4.140.0040.03712.09
5.4.130.0030.03712.07
5.4.120.0050.03512.03
5.4.110.0060.03412.03
5.4.100.0050.03612.03
5.4.90.0100.03312.02
5.4.80.0070.04012.03
5.4.70.0060.03512.03
5.4.60.0030.03812.02
5.4.50.0050.03712.02
5.4.40.0080.03212.01
5.4.30.0090.03212.01
5.4.20.0060.03512.00
5.4.10.0060.03412.00
5.4.00.0050.03711.50
5.3.290.0020.04312.80
5.3.280.0090.03412.71
5.3.270.0080.03812.72
5.3.260.0070.04512.72
5.3.250.0040.04212.72
5.3.240.0070.03612.71
5.3.230.0060.04012.71
5.3.220.0050.04112.68
5.3.210.0070.03712.68
5.3.200.0060.03612.68
5.3.190.0070.03712.68
5.3.180.0100.03512.67
5.3.170.0050.04312.67
5.3.160.0010.04212.67
5.3.150.0080.03412.68
5.3.140.0050.03612.66
5.3.130.0050.03912.66
5.3.120.0100.03412.66
5.3.110.0060.03812.66
5.3.100.0060.03612.12
5.3.90.0050.03712.10
5.3.80.0070.03512.09
5.3.70.0060.03512.09
5.3.60.0040.03712.08
5.3.50.0090.03212.02
5.3.40.0030.03912.02
5.3.30.0080.03211.98
5.3.20.0070.03311.76
5.3.10.0070.03211.73
5.3.00.0080.03411.71
5.2.170.0040.0309.21
5.2.160.0050.0289.21
5.2.150.0040.0319.21
5.2.140.0050.0299.21
5.2.130.0020.0309.18
5.2.120.0050.0279.18
5.2.110.0070.0269.18
5.2.100.0050.0279.17
5.2.90.0040.0299.18
5.2.80.0040.0309.17
5.2.70.0060.0309.17
5.2.60.0040.0309.13
5.2.50.0050.0299.11
5.2.40.0050.0289.08
5.2.30.0060.0329.05
5.2.20.0040.0299.04
5.2.10.0090.0248.95
5.2.00.0060.0278.80
5.1.60.0020.0268.09
5.1.50.0060.0228.09
5.1.40.0050.0238.07
5.1.30.0100.0208.42
5.1.20.0010.0298.44
5.1.10.0040.0268.17
5.1.00.0040.0258.17
5.0.50.0020.0216.64
5.0.40.0040.0236.51
5.0.30.0050.0376.31
5.0.20.0030.0276.28
5.0.10.0020.0226.26
5.0.00.0060.0286.25
4.4.90.0060.0124.77
4.4.80.0030.0154.75
4.4.70.0040.0144.76
4.4.60.0050.0134.75
4.4.50.0020.0164.77
4.4.40.0030.0254.71
4.4.30.0060.0184.75
4.4.20.0040.0214.85
4.4.10.0070.0184.85
4.4.00.0030.0304.76
4.3.110.0030.0164.67
4.3.100.0020.0164.66
4.3.90.0040.0144.63
4.3.80.0040.0234.58
4.3.70.0030.0144.63
4.3.60.0060.0114.63
4.3.50.0000.0184.62
4.3.40.0030.0244.53
4.3.30.0020.0163.30
4.3.20.0030.0193.28
4.3.10.0010.0163.23
4.3.00.0000.0237.89

preferences:
38.29 ms | 401 KiB | 5 Q