3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Request { public function __construct() { echo 'Request created', PHP_EOL; } } 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); echo is_callable($definition) ? 'Callable def' : 'Non-calleable def'; echo is_string($definition) ? 'Class' : 'non-class'; die; 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.0110.00418.56
8.3.50.0100.01021.14
8.3.40.0110.00418.73
8.3.30.0100.00319.04
8.3.20.0040.00420.25
8.3.10.0030.00621.81
8.3.00.0080.00019.48
8.2.180.0150.00618.17
8.2.170.0060.00822.96
8.2.160.0120.00620.57
8.2.150.0050.00224.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0050.00521.95
8.2.110.0100.00020.34
8.2.100.0120.00018.04
8.2.90.0030.00618.15
8.2.80.0030.00617.97
8.2.70.0000.00817.75
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0000.00918.28
8.2.30.0040.00418.14
8.2.20.0040.00417.92
8.2.10.0040.00418.22
8.2.00.0040.00417.77
8.1.280.0100.00725.92
8.1.270.0080.00022.05
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0060.00322.14
8.1.230.0050.00520.97
8.1.220.0050.00317.79
8.1.210.0040.00418.85
8.1.200.0070.00317.22
8.1.190.0050.00317.23
8.1.180.0040.00418.10
8.1.170.0000.00818.59
8.1.160.0000.00721.99
8.1.150.0070.00018.84
8.1.140.0040.00417.49
8.1.130.0070.00017.78
8.1.120.0040.00417.55
8.1.110.0000.00917.38
8.1.100.0030.00617.37
8.1.90.0080.00017.43
8.1.80.0030.00617.48
8.1.70.0030.00317.38
8.1.60.0000.00817.49
8.1.50.0000.00817.54
8.1.40.0060.00317.54
8.1.30.0000.00817.59
8.1.20.0040.00417.75
8.1.10.0050.00317.63
8.1.00.0000.00817.49
8.0.300.0000.00720.14
8.0.290.0030.00516.75
8.0.280.0000.00718.40
8.0.270.0000.00717.20
8.0.260.0070.00017.20
8.0.250.0030.00317.09
8.0.240.0030.00317.07
8.0.230.0050.00216.98
8.0.220.0000.00716.82
8.0.210.0030.00317.03
8.0.200.0050.00316.93
8.0.190.0040.00416.96
8.0.180.0000.00716.96
8.0.170.0040.00416.98
8.0.160.0040.00417.06
8.0.150.0000.00716.98
8.0.140.0040.00416.92
8.0.130.0060.00013.48
8.0.120.0030.00516.96
8.0.110.0000.00816.96
8.0.100.0040.00417.03
8.0.90.0000.00717.04
8.0.80.0080.00816.99
8.0.70.0070.00016.90
8.0.60.0040.00416.82
8.0.50.0050.00216.93
8.0.30.0130.00617.05
8.0.20.0110.01117.41
8.0.10.0040.00417.08
8.0.00.0110.00716.90
7.4.330.0050.00015.14
7.4.320.0030.00316.62
7.4.300.0060.00016.63
7.4.290.0000.00716.67
7.4.280.0030.00616.67
7.4.270.0030.00316.54
7.4.260.0000.00716.59
7.4.250.0000.00716.61
7.4.240.0050.00316.58
7.4.230.0070.00016.57
7.4.220.0060.01216.48
7.4.210.0100.00316.61
7.4.200.0000.00716.44
7.4.160.0120.00616.62
7.4.150.0140.00417.40
7.4.140.0110.00617.86
7.4.130.0110.00716.59
7.4.120.0070.01216.61
7.4.110.0160.00616.62
7.4.100.0140.00316.48
7.4.90.0040.01316.63
7.4.80.0100.00619.39
7.4.70.0030.01316.41
7.4.60.0100.01316.55
7.4.50.0030.00616.41
7.4.40.0100.00716.43
7.4.30.0070.01016.41
7.4.10.0060.01214.96
7.4.00.0080.00815.09
7.3.330.0050.00013.46
7.3.320.0050.00013.46
7.3.310.0000.00716.41
7.3.300.0070.00016.47
7.3.290.0110.00616.47
7.3.280.0090.00716.43
7.3.270.0060.01517.40
7.3.260.0060.01216.50
7.3.250.0130.00516.48
7.3.240.0060.01116.43
7.3.230.0170.00616.62
7.3.210.0030.01816.49
7.3.200.0100.01019.39
7.3.190.0070.01416.46
7.3.180.0030.01316.62
7.3.170.0150.02716.52
7.3.160.0030.01316.64
7.3.130.0070.01314.94
7.3.120.0060.01215.02
7.3.110.0040.01514.68
7.3.100.0040.01114.99
7.3.90.0030.01014.95
7.3.80.0080.00814.71
7.3.70.0060.00615.04
7.3.60.0090.00614.93
7.3.50.0070.00714.93
7.3.40.0030.01314.70
7.3.30.0000.01714.93
7.3.20.0090.00616.65
7.3.10.0000.01316.75
7.3.00.0040.00516.71
7.2.330.0060.01216.78
7.2.320.0060.01216.76
7.2.310.0090.00616.76
7.2.300.0100.00716.73
7.2.290.0070.01116.50
7.2.260.0030.01614.99
7.2.250.0070.01115.05
7.2.240.0090.00615.04
7.2.230.0110.00415.36
7.2.220.0070.01014.80
7.2.210.0040.00815.07
7.2.200.0060.00614.88
7.2.190.0090.00615.28
7.2.180.0070.01014.74
7.2.170.0000.01415.19
7.2.160.0030.01415.14
7.2.150.0060.01016.70
7.2.140.0030.01317.13
7.2.130.0080.00816.95
7.2.120.0100.00316.70
7.2.110.0100.00716.75
7.2.100.0100.00316.95
7.2.90.0030.00717.14
7.2.80.0030.01517.02
7.2.70.0100.00617.03
7.2.60.0120.00916.92
7.2.50.0070.01016.87
7.2.40.0040.01116.78
7.2.30.0040.01417.07
7.2.20.0060.00917.18
7.2.10.0070.01117.00
7.2.00.0030.01416.96
7.1.330.0030.01515.76
7.1.320.0100.00715.67
7.1.310.0040.01115.57
7.1.300.0070.00715.80
7.1.290.0040.01115.59
7.1.280.0070.00715.50
7.1.270.0100.00315.73
7.1.260.0070.00715.90
7.1.250.0000.01215.84
7.1.240.0100.00315.60
7.1.230.0070.01015.88
7.1.220.0110.00315.86
7.1.210.0000.01415.90
7.1.200.0050.00415.79
7.1.190.0000.01215.62
7.1.180.0100.00315.78
7.1.170.0090.00315.74
7.1.160.0090.00615.85
7.1.150.0060.01215.76
7.1.140.0030.01215.63
7.1.130.0060.00615.89
7.1.120.0000.01415.46
7.1.110.0070.00315.86
7.1.100.0060.00817.02
7.1.90.0080.00415.95
7.1.80.0100.00715.80
7.1.70.0080.00316.36
7.1.60.0060.01317.48
7.1.50.0030.01716.25
7.1.40.0090.00815.40
7.1.30.0000.00915.72
7.1.20.0030.01015.45
7.1.10.0030.01115.50
7.1.00.0080.03819.04
7.0.330.0100.00315.44
7.0.320.0030.00815.48
7.0.310.0040.01115.41
7.0.300.0030.01015.50
7.0.290.0110.00715.35
7.0.280.0040.01115.44
7.0.270.0070.00715.38
7.0.260.0060.01015.34
7.0.250.0040.00715.32
7.0.240.0040.01115.52
7.0.230.0050.00915.36
7.0.220.0080.00415.48
7.0.210.0000.01315.50
7.0.200.0070.00616.13
7.0.190.0090.00615.42
7.0.180.0040.00815.66
7.0.170.0030.00715.25
7.0.160.0000.01515.38
7.0.150.0000.01215.45
7.0.140.0000.04118.63
7.0.130.0000.01415.50
7.0.120.0030.00615.61
7.0.110.0100.00315.38
7.0.100.0070.00315.37
7.0.90.0070.00715.53
7.0.80.0030.01015.52
7.0.70.0070.00715.46
7.0.60.0060.04617.62
7.0.50.0080.04216.56
7.0.40.0060.04216.74
7.0.30.0120.03916.94
7.0.20.0150.03216.90
7.0.10.0120.04016.71
7.0.00.0050.04916.84
5.6.400.0040.01114.41
5.6.390.0030.00914.53
5.6.380.0100.00314.12
5.6.370.0030.00914.58
5.6.360.0080.00614.11
5.6.350.0060.00914.50
5.6.340.0060.00614.64
5.6.330.0030.01214.71
5.6.320.0070.00714.47
5.6.310.0180.00014.68
5.6.300.0040.00714.34
5.6.290.0070.00314.20
5.6.280.0080.03817.91
5.6.270.0060.00914.57
5.6.260.0000.01014.60
5.6.250.0000.01414.59
5.6.240.0060.00314.54
5.6.230.0040.00814.52
5.6.220.0030.01014.52
5.6.210.0080.03317.52
5.6.200.0090.03616.26
5.6.190.0070.04617.62
5.6.180.1730.02317.65
5.6.170.0240.03717.59
5.6.160.0050.04017.41
5.6.150.0070.03316.26
5.6.140.0110.04116.31
5.6.130.0030.03016.36
5.6.120.0080.03017.69
5.6.110.0150.03817.68
5.6.100.0110.04317.77
5.6.90.0070.04417.86
5.6.80.0020.04717.41
5.6.70.2350.02017.42
5.6.60.0060.00914.23
5.6.50.0070.00714.21
5.6.40.0070.00714.29
5.6.30.0100.00014.26
5.6.20.0030.01014.34
5.6.10.0120.00314.34
5.6.00.0070.00714.26
5.5.380.0000.01514.61
5.5.370.0040.00714.37
5.5.360.0000.01414.71
5.5.350.0100.04317.27
5.5.340.0070.04316.12
5.5.330.0070.02417.31
5.5.320.1640.03317.50
5.5.310.0130.03117.38
5.5.300.0050.03816.35
5.5.290.0050.02316.31
5.5.280.0070.02417.46
5.5.270.0050.04617.61
5.5.260.0110.04117.55
5.5.250.0020.02517.49
5.5.240.0220.03517.29
5.5.230.0050.00514.16
5.5.220.0110.00014.30
5.5.210.0070.00314.48
5.5.200.0100.00714.22
5.5.190.0070.00714.39
5.5.180.0090.00314.44
5.5.170.0040.00713.86
5.5.160.0000.01314.41
5.5.150.0000.01414.35
5.5.140.0000.01414.55
5.5.130.0000.01014.45
5.5.120.0030.01014.29
5.5.110.0090.00314.45
5.5.100.0030.01014.14
5.5.90.0000.01314.50
5.5.80.0060.00613.94
5.5.70.0050.00314.11
5.5.60.0060.00613.91
5.5.50.0060.00614.37
5.5.40.0030.01414.46
5.5.30.0140.00414.59
5.5.20.0030.01014.41
5.5.10.0080.00414.39
5.5.00.0070.00714.41
5.4.450.0370.03115.18
5.4.440.0050.03315.41
5.4.430.0100.03215.32
5.4.420.0380.00115.35
5.4.410.0320.00515.41
5.4.400.0380.00215.14
5.4.390.0340.00415.04
5.4.380.0350.00215.23
5.4.370.0340.00315.13
5.4.360.0320.00315.14
5.4.350.0320.00515.27
5.4.340.0040.02011.69
5.4.330.0060.00611.30
5.4.320.0030.02211.98
5.4.310.0060.02111.95
5.4.300.0060.02011.85
5.4.290.0070.02011.76
5.4.280.0040.02011.84
5.4.270.0060.02011.74
5.4.260.0020.02311.77
5.4.250.0020.02411.74
5.4.240.0040.02411.70
5.4.230.0040.02011.73
5.4.220.0040.02411.73
5.4.210.0050.02211.71
5.4.200.0050.02411.72
5.4.190.0070.02111.69
5.4.180.0020.02311.84
5.4.170.0050.01911.79
5.4.160.0060.02311.86
5.4.150.0040.02211.84
5.4.140.0060.01911.63
5.4.130.0060.02311.59
5.4.120.0080.02111.54
5.4.110.0050.02111.61
5.4.100.0060.02211.61
5.4.90.0050.02211.59
5.4.80.0050.02211.59
5.4.70.0040.02011.56
5.4.60.0040.02111.63
5.4.50.0040.02111.69
5.4.40.0090.01711.55
5.4.30.0080.01711.64
5.4.20.0010.02411.60
5.4.10.0050.02011.67
5.4.00.0040.02011.36
5.3.290.0050.04012.80
5.3.280.0040.03812.71
5.3.270.0040.03912.72
5.3.260.0080.04312.72
5.3.250.0050.03612.72
5.3.240.0060.03512.72
5.3.230.0040.03912.71
5.3.220.0070.03412.68
5.3.210.0030.04312.68
5.3.200.0060.03612.68
5.3.190.0070.03712.67
5.3.180.0090.03412.67
5.3.170.0060.03712.67
5.3.160.0060.04012.67
5.3.150.0090.04312.68
5.3.140.0070.03412.66
5.3.130.0060.03812.66
5.3.120.0070.04612.66
5.3.110.0060.04312.66
5.3.100.0060.03912.12
5.3.90.0060.03612.11
5.3.80.0150.03012.09
5.3.70.0080.03812.09
5.3.60.0080.03312.08
5.3.50.0090.03312.02
5.3.40.0110.03112.02
5.3.30.0080.03411.98
5.3.20.0080.03811.75
5.3.10.0050.03611.73
5.3.00.0050.04111.71
5.2.170.0060.0339.21
5.2.160.0040.0309.21
5.2.150.0060.0369.22
5.2.140.0010.0359.21
5.2.130.0080.0259.17
5.2.120.0030.0359.17
5.2.110.0070.0329.18
5.2.100.0060.0329.18
5.2.90.0050.0279.18
5.2.80.0040.0309.17
5.2.70.0080.0309.18
5.2.60.0050.0329.14
5.2.50.0060.0279.10
5.2.40.0030.0299.08
5.2.30.0020.0319.05
5.2.20.0030.0299.04
5.2.10.0020.0318.95
5.2.00.0070.0328.81
5.1.60.0040.0238.09
5.1.50.0060.0228.09
5.1.40.0040.0268.07
5.1.30.0040.0298.42
5.1.20.0030.0268.44
5.1.10.0060.0238.17
5.1.00.0030.0258.17
5.0.50.0040.0196.64
5.0.40.0050.0226.51
5.0.30.0030.0306.31
5.0.20.0010.0236.28
5.0.10.0050.0186.27
5.0.00.0020.0386.25
4.4.90.0030.0154.78
4.4.80.0040.0154.75
4.4.70.0020.0214.76
4.4.60.0040.0204.75
4.4.50.0020.0204.77
4.4.40.0050.0274.71
4.4.30.0020.0194.76
4.4.20.0030.0154.84
4.4.10.0020.0194.85
4.4.00.0040.0244.76
4.3.110.0020.0164.67
4.3.100.0070.0164.67
4.3.90.0030.0144.63
4.3.80.0020.0274.58
4.3.70.0040.0194.63
4.3.60.0040.0174.62
4.3.50.0020.0164.62
4.3.40.0020.0314.54
4.3.30.0000.0173.30
4.3.20.0010.0203.28
4.3.10.0010.0163.23
4.3.00.0170.0137.89

preferences:
47.78 ms | 401 KiB | 5 Q