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 class_exists($definition) ? 'Class' : 'non-class'; die; return $definition(); } } $di = new DI(); //Using an anonymous function $di->set('request', function(){ return new Request(); }); //Using an anonymous function $di->set('request', '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.0040.01118.30
8.3.50.0260.01121.95
8.3.40.0030.01218.96
8.3.30.0140.00019.25
8.3.20.0000.00720.14
8.3.10.0040.00421.96
8.3.00.0080.00019.36
8.2.180.0000.01616.88
8.2.170.0110.00422.96
8.2.160.0130.00320.35
8.2.150.0130.00624.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0000.00721.98
8.2.110.0050.00519.30
8.2.100.0090.00317.91
8.2.90.0090.00019.21
8.2.80.0050.00317.97
8.2.70.0030.00517.63
8.2.60.0030.00717.93
8.2.50.0000.00918.10
8.2.40.0070.00020.59
8.2.30.0000.00718.16
8.2.20.0040.00417.91
8.2.10.0040.00418.16
8.2.00.0040.00417.91
8.1.280.0130.00625.92
8.1.270.0080.00022.06
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0040.00421.32
8.1.230.0080.00417.45
8.1.220.0050.00317.79
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0000.00917.35
8.1.180.0040.00418.10
8.1.170.0080.00018.59
8.1.160.0070.00021.93
8.1.150.0070.00018.84
8.1.140.0030.00617.49
8.1.130.0030.00317.91
8.1.120.0050.00217.49
8.1.110.0000.00817.47
8.1.100.0080.00017.50
8.1.90.0000.00717.47
8.1.80.0000.00717.52
8.1.70.0000.00717.48
8.1.60.0000.00817.52
8.1.50.0050.00317.60
8.1.40.0050.00217.54
8.1.30.0040.00417.54
8.1.20.0030.00617.66
8.1.10.0000.00817.54
8.1.00.0030.00617.54
8.0.300.0020.00518.77
8.0.290.0070.00017.00
8.0.280.0000.00718.53
8.0.270.0030.00317.28
8.0.260.0000.00717.29
8.0.250.0000.00717.10
8.0.240.0080.00017.01
8.0.230.0030.00316.92
8.0.220.0030.00417.04
8.0.210.0050.00316.90
8.0.200.0030.00317.06
8.0.190.0000.00717.02
8.0.180.0000.00816.91
8.0.170.0030.00517.02
8.0.160.0030.00317.06
8.0.150.0050.00216.93
8.0.140.0040.00416.93
8.0.130.0060.00013.51
8.0.120.0040.00416.97
8.0.110.0050.00317.01
8.0.100.0000.00716.98
8.0.90.0050.00216.90
8.0.80.0090.00616.94
8.0.70.0040.00416.94
8.0.60.0040.00416.79
8.0.50.0050.00216.88
8.0.30.0100.01016.93
8.0.20.0120.00717.40
8.0.10.0040.00417.18
8.0.00.0090.00916.79
7.4.330.0020.00215.15
7.4.320.0000.00616.64
7.4.300.0060.00016.68
7.4.290.0000.00716.64
7.4.280.0040.00416.63
7.4.270.0070.00016.57
7.4.260.0000.00716.67
7.4.250.0040.00416.37
7.4.240.0050.00216.60
7.4.230.0000.00716.43
7.4.220.0070.01116.54
7.4.210.0030.01016.71
7.4.200.0000.00716.42
7.4.160.0100.00616.58
7.4.150.0150.01017.40
7.4.140.0110.00717.86
7.4.130.0100.00916.59
7.4.120.0110.00716.57
7.4.110.0070.01016.49
7.4.100.0030.01316.71
7.4.90.0050.01116.62
7.4.80.0090.00919.39
7.4.70.0140.00316.50
7.4.60.0110.00616.67
7.4.50.0090.00016.61
7.4.40.0080.00916.62
7.4.30.0040.01316.62
7.4.00.0100.00814.95
7.3.330.0050.00013.46
7.3.320.0000.00513.54
7.3.310.0040.00416.45
7.3.300.0030.00316.36
7.3.290.0060.01216.46
7.3.280.0090.00516.46
7.3.270.0220.00317.40
7.3.260.0060.01216.45
7.3.250.0130.00516.43
7.3.240.0090.01316.59
7.3.230.0120.00416.43
7.3.210.0100.00716.46
7.3.200.0100.00719.39
7.3.190.0070.01416.45
7.3.180.0110.00416.41
7.3.170.0100.01016.77
7.3.160.0100.00616.63
7.3.120.0100.00715.06
7.3.110.0030.00914.87
7.3.100.0040.00415.15
7.3.90.0060.00614.83
7.3.80.0030.00714.92
7.3.70.0030.01014.75
7.3.60.0100.00314.93
7.3.50.0070.00714.82
7.3.40.0110.00614.66
7.3.30.0100.00014.96
7.3.20.0000.01616.58
7.3.10.0110.00416.54
7.3.00.0080.00516.79
7.2.330.0060.01216.43
7.2.320.0060.01016.73
7.2.310.0070.01016.83
7.2.300.0080.00816.53
7.2.290.0060.01216.59
7.2.250.0080.00814.88
7.2.240.0070.01015.11
7.2.230.0040.00715.00
7.2.220.0090.00614.95
7.2.210.0060.00915.24
7.2.200.0040.00715.26
7.2.190.0090.00614.87
7.2.180.0000.01415.25
7.2.170.0030.01315.12
7.2.130.0030.01417.02
7.2.120.0140.00417.02
7.2.110.0120.00417.11
7.2.100.0030.00716.94
7.2.90.0100.00316.78
7.2.80.0000.01516.95
7.2.70.0070.00716.98
7.2.60.0130.00616.68
7.2.50.0100.00716.91
7.2.40.0030.00717.15
7.2.30.0030.01016.70
7.2.20.0070.01017.00
7.2.10.0100.01017.00
7.2.00.0090.00818.01
7.1.330.0130.00315.79
7.1.320.0000.01415.45
7.1.310.0030.00615.63
7.1.300.0030.00915.96
7.1.290.0030.01015.67
7.1.280.0100.00315.94
7.1.270.0060.00615.70
7.1.260.0090.00615.88
7.1.250.0140.00015.51
7.1.240.0000.01515.90
7.1.230.0110.00315.80
7.1.220.0040.00715.71
7.1.210.0070.01015.66
7.1.200.0130.00315.68
7.1.190.0070.00715.69
7.1.180.0000.01315.88
7.1.170.0100.00315.80
7.1.160.0070.00715.44
7.1.150.0030.01015.94
7.1.140.0000.01615.82
7.1.130.0090.00615.81
7.1.120.0030.01015.81
7.1.110.0070.00715.84
7.1.100.0010.01016.94
7.1.90.0090.00416.02
7.1.80.0060.00915.69
7.1.70.0000.00816.45
7.1.60.0100.00917.42
7.1.50.0110.01016.31
7.1.40.0050.00315.70
7.1.30.0070.00715.79
7.1.20.0000.00915.95
7.1.10.0170.00415.76
7.1.00.0050.04119.21
7.0.330.0130.00315.64
7.0.320.0070.01015.33
7.0.310.0100.00715.36
7.0.300.0060.00615.47
7.0.290.0070.00315.31
7.0.280.0070.00715.13
7.0.270.0000.01315.34
7.0.260.0080.00515.43
7.0.250.0140.00015.31
7.0.240.0090.00615.54
7.0.230.0130.00715.09
7.0.220.0070.00715.24
7.0.210.0110.00415.06
7.0.200.0070.00516.00
7.0.190.0070.00715.29
7.0.180.0110.00415.47
7.0.170.0070.00715.24
7.0.160.0080.00715.46
7.0.150.0040.00715.29
7.0.140.0020.04118.65
7.0.130.0030.01115.19
7.0.120.0090.00615.21
7.0.110.0040.01115.34
7.0.100.0030.01315.10
7.0.90.0000.01215.30
7.0.80.0070.00715.35
7.0.70.0040.01215.28
7.0.60.0090.04617.66
7.0.50.0100.04016.55
7.0.40.0070.02716.88
7.0.30.0240.03516.95
7.0.20.0230.02516.77
7.0.10.0050.04516.84
7.0.00.0060.02516.90
5.6.380.0040.01114.50
5.6.370.0030.01314.44
5.6.360.0030.01014.38
5.6.350.0130.00314.54
5.6.340.0060.00613.93
5.6.330.0080.00314.27
5.6.320.0070.01013.88
5.6.310.0040.00814.53
5.6.300.0000.01414.19
5.6.290.0060.00313.98
5.6.280.0020.04517.71
5.6.270.0080.00414.36
5.6.260.0030.01214.49
5.6.250.0070.00714.31
5.6.240.0070.00314.07
5.6.230.0040.01114.42
5.6.220.0060.00914.31
5.6.210.0070.02317.39
5.6.200.0030.04516.39
5.6.190.0100.04317.45
5.6.180.1870.02417.36
5.6.170.0150.03617.37
5.6.160.0110.04217.48
5.6.150.0070.02316.28
5.6.140.0100.02816.32
5.6.130.0090.04416.27
5.6.120.0100.02417.53
5.6.110.0030.02817.73
5.6.100.0070.03717.44
5.6.90.0100.03317.55
5.6.80.0090.03917.29
5.6.70.2180.02017.44
5.6.60.0070.00414.24
5.6.50.0090.00514.12
5.6.40.0110.00014.27
5.6.30.0030.00814.26
5.6.20.0070.00314.35
5.6.10.0060.00914.12
5.6.00.0070.00714.43
5.5.380.0070.00311.05
5.5.370.0000.00911.57
5.5.360.0050.00511.56
5.5.350.0070.02215.86
5.5.340.0000.03014.57
5.5.330.0070.04515.72
5.5.320.1730.02015.90
5.5.310.0180.03315.71
5.5.300.0000.04914.60
5.5.290.0070.04214.49
5.5.280.0070.04015.97
5.5.270.0130.01815.81
5.5.260.0050.04615.99
5.5.250.0050.03215.89
5.5.240.0130.04015.71
5.5.230.0050.00511.38
5.5.220.0030.00611.09
5.5.210.0050.00511.00
5.5.200.0070.00011.02
5.5.190.0030.00711.00
5.5.180.0040.00711.13
5.5.170.0050.00511.00
5.5.160.0090.00311.00
5.5.150.0040.00811.08
5.5.140.0030.00611.00
5.5.130.0030.00911.00
5.5.120.0050.00511.00
5.5.110.0030.00811.00
5.5.100.0060.00611.18
5.5.90.0030.00911.00
5.5.80.0090.00311.11
5.5.70.0040.00411.00
5.5.60.0060.00611.25
5.5.50.0030.00311.00
5.5.40.0030.00611.20
5.5.30.0040.00411.00
5.5.20.0070.00311.18
5.5.10.0050.00411.00
5.5.00.0080.00511.00
5.4.450.0120.03015.34
5.4.440.0150.02515.17
5.4.430.0130.02915.33
5.4.420.0330.00315.21
5.4.410.0330.00415.29
5.4.400.0320.00315.11
5.4.390.0350.00315.07
5.4.380.0370.00115.12
5.4.370.0320.00215.14
5.4.360.0320.00415.06
5.4.350.0390.00015.06
5.4.340.0060.02211.52
5.4.330.0050.00811.16
5.4.320.0070.02211.76
5.4.310.0080.02011.76
5.4.300.0090.02011.84
5.4.290.0060.02011.76
5.4.280.0050.02111.71
5.4.270.0060.01911.71
5.4.260.0070.02111.71
5.4.250.0080.02011.71
5.4.240.0060.02011.71
5.4.230.0050.02211.72
5.4.220.0030.02511.71
5.4.210.0040.02111.77
5.4.200.0070.01911.70
5.4.190.0050.02111.88
5.4.180.0050.02111.79
5.4.170.0060.02111.71
5.4.160.0060.02211.70
5.4.150.0110.01811.87
5.4.140.0100.02311.60
5.4.130.0070.01911.66
5.4.120.0070.01911.58
5.4.110.0060.02211.54
5.4.100.0110.01611.66
5.4.90.0060.02411.52
5.4.80.0050.02411.67
5.4.70.0080.01911.64
5.4.60.0070.01911.57
5.4.50.0080.02111.62
5.4.40.0070.01911.66
5.4.30.0080.02111.64
5.4.20.0070.02411.51
5.4.10.0080.01811.53
5.4.00.0040.02211.33
5.3.290.0040.02211.90
5.3.280.0050.02011.86
5.3.270.0080.01911.86
5.3.260.0070.02011.86
5.3.250.0070.02011.86
5.3.240.0070.01911.86
5.3.230.0070.01811.86
5.3.220.0080.02011.84
5.3.210.0050.02511.84
5.3.200.0080.01911.84
5.3.190.0050.02311.84
5.3.180.0060.02211.84
5.3.170.0090.01911.84
5.3.160.0060.02311.84
5.3.150.0080.02011.84
5.3.140.0110.01611.83
5.3.130.0040.02311.83
5.3.120.0080.02011.83
5.3.110.0060.02211.83
5.3.100.0060.02111.56
5.3.90.0050.02111.55
5.3.80.0070.01911.55
5.3.70.0040.02011.55
5.3.60.0070.02011.54
5.3.50.0050.02211.51
5.3.40.0080.01811.51
5.3.30.0030.02211.49
5.3.20.0040.01911.38
5.3.10.0090.01411.37
5.3.00.0040.02111.36
5.2.170.0040.01810.11
5.2.160.0070.01410.11
5.2.150.0040.01810.11
5.2.140.0020.02110.11
5.2.130.0070.01610.09
5.2.120.0020.01610.09
5.2.110.0020.01810.09
5.2.100.0040.01610.09
5.2.90.0040.01510.09
5.2.80.0050.02110.09
5.2.70.0050.01810.09
5.2.60.0040.01910.07
5.2.50.0070.01710.05
5.2.40.0020.01710.04
5.2.30.0040.01910.03
5.2.20.0040.01910.02
5.2.10.0060.0199.97
5.2.00.0060.0169.91
5.1.60.0050.0129.55
5.1.50.0050.0139.55
5.1.40.0060.0119.54
5.1.30.0060.0129.71
5.1.20.0020.0179.72
5.1.10.0050.0139.59
5.1.00.0030.0169.59
5.0.50.0050.0128.82
5.0.40.0020.0138.75
5.0.30.0030.0168.66
5.0.20.0040.0118.64
5.0.10.0040.0118.63
5.0.00.0030.0198.63
4.4.90.0010.0107.89
4.4.80.0020.0097.88
4.4.70.0020.0097.88
4.4.60.0020.0097.88
4.4.50.0040.0087.89
4.4.40.0020.0147.86
4.4.30.0040.0087.88
4.4.20.0050.0077.92
4.4.10.0010.0117.93
4.4.00.0020.0157.88
4.3.110.0020.0107.84
4.3.100.0020.0107.83
4.3.90.0020.0127.82
4.3.80.0040.0127.79
4.3.70.0020.0097.82
4.3.60.0010.0117.82
4.3.50.0020.0087.82
4.3.40.0040.0127.77
4.3.30.0030.0107.15
4.3.20.0040.0097.14
4.3.10.0030.0107.12
4.3.00.0020.0129.45

preferences:
39.5 ms | 401 KiB | 5 Q