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_calleable($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.0090.00618.46
8.3.50.0130.00616.49
8.3.40.0110.00719.09
8.3.30.0110.00319.04
8.3.20.0000.00720.33
8.3.10.0040.00421.93
8.3.00.0000.00819.63
8.2.180.0130.01018.54
8.2.170.0040.01122.96
8.2.160.0070.01020.39
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0050.00226.16
8.2.120.0000.00822.05
8.2.110.0030.00620.52
8.2.100.0000.01117.85
8.2.90.0050.00318.22
8.2.80.0000.00817.97
8.2.70.0050.00317.63
8.2.60.0030.00517.93
8.2.50.0000.00818.07
8.2.40.0050.00319.88
8.2.30.0000.00718.16
8.2.20.0000.00817.77
8.2.10.0000.00718.12
8.2.00.0050.00517.89
8.1.280.0030.01725.92
8.1.270.0080.00022.10
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0030.00622.10
8.1.230.0040.00720.86
8.1.220.0030.00517.74
8.1.210.0040.00418.91
8.1.200.0070.00317.36
8.1.190.0000.00917.23
8.1.180.0040.00418.10
8.1.170.0080.00018.64
8.1.160.0040.00422.04
8.1.150.0050.00218.91
8.1.140.0040.00417.40
8.1.130.0030.00317.95
8.1.120.0040.00417.53
8.1.110.0050.00217.51
8.1.100.0050.00217.46
8.1.90.0070.00017.49
8.1.80.0060.00317.47
8.1.70.0000.00717.43
8.1.60.0050.00317.52
8.1.50.0000.00817.51
8.1.40.0040.00417.55
8.1.30.0080.00017.62
8.1.20.0040.00417.60
8.1.10.0080.00017.50
8.1.00.0030.00617.60
8.0.300.0000.00719.96
8.0.290.0040.00416.88
8.0.280.0030.00318.46
8.0.270.0030.00317.21
8.0.260.0000.00817.30
8.0.250.0030.00316.94
8.0.240.0030.00317.07
8.0.230.0070.00017.04
8.0.220.0030.00316.91
8.0.210.0030.00317.02
8.0.200.0000.00817.02
8.0.190.0040.00417.10
8.0.180.0080.00016.93
8.0.170.0030.00516.92
8.0.160.0000.00716.96
8.0.150.0000.00716.94
8.0.140.0000.00716.99
8.0.130.0000.00613.42
8.0.120.0000.00816.98
8.0.110.0070.00017.00
8.0.100.0030.00516.93
8.0.90.0070.00016.88
8.0.80.0040.01117.02
8.0.70.0040.00416.95
8.0.60.0000.00716.92
8.0.50.0050.00317.06
8.0.30.0160.00516.90
8.0.20.0130.00717.40
8.0.10.0000.00917.07
8.0.00.0070.01416.97
7.4.330.0030.00315.08
7.4.320.0000.00616.64
7.4.300.0000.00616.48
7.4.290.0000.00716.52
7.4.280.0030.00516.63
7.4.270.0060.00016.68
7.4.260.0040.00416.61
7.4.250.0040.00416.45
7.4.240.0040.00316.47
7.4.230.0000.00716.51
7.4.220.0140.00416.59
7.4.210.0030.01016.68
7.4.200.0030.00316.52
7.4.160.0170.01716.40
7.4.150.0170.00717.40
7.4.140.0120.00817.86
7.4.130.0070.01216.66
7.4.120.0130.00616.46
7.4.110.0090.01216.61
7.4.100.0070.01416.44
7.4.90.0090.00916.38
7.4.80.0060.01219.39
7.4.70.0080.01116.73
7.4.60.0030.01516.46
7.4.50.0000.00516.61
7.4.40.0090.00916.68
7.4.30.0090.00916.67
7.4.00.0070.01115.07
7.3.330.0020.00213.32
7.3.320.0000.00513.46
7.3.310.0040.00416.48
7.3.300.0000.00716.46
7.3.290.0070.00816.45
7.3.280.0070.01016.42
7.3.270.0030.01417.40
7.3.260.0120.00616.44
7.3.250.0090.00816.42
7.3.240.0160.00616.50
7.3.230.0100.00716.66
7.3.210.0090.01216.71
7.3.200.0090.01219.39
7.3.190.0100.00716.57
7.3.180.0000.01516.49
7.3.170.0090.00916.55
7.3.160.0130.00716.64
7.3.10.0040.01116.82
7.3.00.0080.01116.77
7.2.330.0170.00716.38
7.2.320.0090.01216.82
7.2.310.0180.00616.81
7.2.300.0090.00916.84
7.2.290.0120.00616.65
7.2.130.0160.00016.87
7.2.120.0030.01216.96
7.2.110.0110.00716.61
7.2.100.0160.00316.88
7.2.90.0100.00317.06
7.2.80.0060.01416.92
7.2.70.0190.00316.92
7.2.60.0170.00716.83
7.2.50.0060.01316.86
7.2.40.0040.00716.99
7.2.30.0060.00616.95
7.2.20.0040.01116.93
7.2.10.0040.01116.96
7.2.00.0060.01217.08
7.1.250.0120.00816.03
7.1.240.0080.00315.91
7.1.230.0100.00315.86
7.1.220.0090.00915.69
7.1.210.0130.00015.47
7.1.200.0020.01115.78
7.1.190.0080.00615.90
7.1.180.0140.00715.76
7.1.170.0060.00915.93
7.1.160.0110.00015.86
7.1.150.0090.00615.77
7.1.140.0070.00315.66
7.1.130.0090.00315.75
7.1.120.0090.00415.57
7.1.110.0040.00815.99
7.1.100.0170.00417.12
7.1.90.0040.01115.98
7.1.80.0030.01015.89
7.1.70.0050.00616.40
7.1.60.0050.01117.47
7.1.50.0180.00725.27
7.1.40.0060.00815.79
7.1.30.0050.01015.71
7.1.20.0150.00415.99
7.1.10.0040.01115.93
7.1.00.0060.04019.11
7.0.330.0070.01115.20
7.0.320.0150.00715.21
7.0.310.0110.00815.09
7.0.300.0080.00815.20
7.0.290.0050.00515.27
7.0.280.0030.01015.47
7.0.270.0100.01015.39
7.0.260.0080.00315.32
7.0.250.0040.00915.17
7.0.240.0100.01015.50
7.0.230.0030.01015.28
7.0.220.0140.00415.35
7.0.210.0130.00615.53
7.0.200.0100.00516.24
7.0.190.0030.01015.39
7.0.180.0070.00715.53
7.0.170.0070.00715.25
7.0.160.0070.00715.18
7.0.150.0080.00415.40
7.0.140.0070.03818.68
7.0.130.0090.00615.30
7.0.120.0070.00315.59
7.0.110.0020.05417.70
7.0.100.0080.02617.64
7.0.90.0080.02717.71
7.0.80.0090.02217.66
7.0.70.0080.02317.58
7.0.60.0070.02517.56
7.0.50.0030.02617.77
7.0.40.0040.02316.55
7.0.30.0020.02416.56
7.0.20.0060.01816.51
7.0.10.0030.02516.55
7.0.00.0050.02116.40
5.6.380.0000.01414.27
5.6.370.0100.00314.34
5.6.360.0070.01114.30
5.6.350.0000.01414.52
5.6.340.0070.00714.17
5.6.330.0040.01214.30
5.6.320.0030.01014.21
5.6.310.0070.00714.51
5.6.300.0070.00714.20
5.6.290.0090.00614.31
5.6.280.0050.03917.68
5.6.270.0070.00714.46
5.6.260.0050.02317.56
5.6.250.0060.03817.49
5.6.240.0050.02217.56
5.6.230.0080.04217.63
5.6.220.0050.02817.55
5.6.210.0000.02617.52
5.6.200.0050.02517.66
5.6.190.0020.02617.56
5.6.180.0000.02417.60
5.6.170.0050.02517.50
5.6.160.0030.02817.45
5.6.150.0090.01917.25
5.6.140.0100.02217.42
5.6.130.0070.02517.61
5.6.120.0070.02317.48
5.6.110.0030.02517.34
5.6.100.0050.02817.41
5.6.90.0020.02117.37
5.6.80.0070.02216.99
5.6.70.0050.02317.14
5.6.60.0030.02517.04
5.6.50.0030.02117.12
5.6.40.0000.02617.28
5.6.30.0100.01817.02
5.6.20.0080.01817.06
5.6.10.0030.02017.33
5.6.00.0090.01617.24
5.5.380.0000.05014.65
5.5.370.0090.02714.40
5.5.360.0050.02314.36
5.5.350.0030.02414.53
5.5.340.0070.02014.62
5.5.330.0040.02414.82
5.5.320.0060.02714.67
5.5.310.0030.02514.67
5.5.300.0030.03714.60
5.5.290.0040.02414.77
5.5.280.0080.02014.61
5.5.270.0050.02514.43
5.5.260.0020.02414.55
5.5.250.0050.02214.37
5.5.240.0000.02614.20
5.5.230.0050.02514.46
5.5.220.0020.02214.20
5.5.210.0060.02414.12
5.5.200.0060.02314.42
5.5.190.0040.02514.23
5.5.180.0080.02114.24
5.5.170.0040.00710.99
5.5.160.0060.01614.13
5.5.150.0030.02014.19
5.5.140.0050.02114.22
5.5.130.0100.03614.36
5.5.120.0020.04214.31
5.5.110.0030.02714.21
5.5.100.0040.02414.25
5.5.90.0080.03014.13
5.5.80.0030.04414.09
5.5.70.0020.04714.21
5.5.60.0030.02014.04
5.5.50.0050.03514.21
5.5.40.0060.02214.05
5.5.30.0080.02514.02
5.5.20.0050.03913.98
5.5.10.0030.04314.11
5.5.00.0000.02614.22
5.4.450.0030.02315.07
5.4.440.0030.02215.19
5.4.430.0020.02515.17
5.4.420.0050.02115.29
5.4.410.0040.02215.05
5.4.400.0050.02114.93
5.4.390.0030.02515.15
5.4.380.0030.02015.14
5.4.370.0050.01515.15
5.4.360.0050.02015.18
5.4.350.0070.01515.04
5.4.340.0020.02415.19
5.4.330.0000.00810.83
5.4.320.0050.02215.16
5.4.310.0030.02615.11
5.4.300.0030.02315.19
5.4.290.0050.04415.09
5.4.280.0030.02315.18
5.4.270.0070.04015.14
5.4.260.0050.04015.21
5.4.250.0080.03815.00
5.4.240.0050.02814.87
5.4.230.0100.02015.26
5.4.220.0030.02615.14
5.4.210.0070.04114.93
5.4.200.0050.03515.02
5.4.190.0030.02815.01
5.4.180.0080.03514.98
5.4.170.0110.03814.88
5.4.160.0080.02315.11
5.4.150.0080.03114.97
5.4.140.0060.02413.73
5.4.130.0030.02113.51
5.4.120.0070.01513.78
5.4.110.0020.02313.75
5.4.100.0050.04013.77
5.4.90.0010.03413.54
5.4.80.0070.03713.45
5.4.70.0050.03913.74
5.4.60.0060.02613.62
5.4.50.0120.03413.77
5.4.40.0110.03013.79
5.4.30.0020.04413.63
5.4.20.0070.02913.64
5.4.10.0080.03813.70
5.4.00.0030.04013.33
5.3.290.0030.01912.58
5.3.280.0040.04212.35
5.3.270.0020.04412.44
5.3.260.0080.02212.33
5.3.250.0030.02912.39
5.3.240.0060.03312.32
5.3.230.0050.03312.41
5.3.220.0060.02512.38
5.3.210.0120.01712.50
5.3.200.0070.03012.27
5.3.190.0080.03512.33
5.3.180.0020.02212.56
5.3.170.0020.03512.45
5.3.160.0060.03812.49
5.3.150.0050.02412.53
5.3.140.0090.03312.46
5.3.130.0030.02412.46
5.3.120.0070.04212.35
5.3.110.0060.04112.37
5.3.100.0060.03312.26
5.3.90.0050.04212.24
5.3.80.0080.03812.14
5.3.70.0050.03312.11
5.3.60.0100.03712.07
5.3.50.0060.03512.16
5.3.40.0070.03512.08
5.3.30.0020.03312.00
5.3.20.0050.02911.93
5.3.10.0050.02311.92
5.3.00.0020.02011.79
5.2.170.0050.03010.70
5.2.160.0050.03310.70
5.2.150.0020.03410.70
5.2.140.0030.02110.70
5.2.130.0050.01810.70
5.2.120.0070.02610.70
5.2.110.0000.02310.70
5.2.100.0020.03210.70
5.2.90.0060.03110.70
5.2.80.0050.01810.70
5.2.70.0030.03610.70
5.2.60.0020.01710.70
5.2.50.0020.02810.70
5.2.40.0020.03510.70
5.2.30.0050.03010.70
5.2.20.0030.02510.70
5.2.10.0050.02710.70
5.2.00.0010.03110.70
5.1.60.0040.02910.70
5.1.50.0030.03010.70
5.1.40.0030.03010.70
5.1.30.0000.01410.70
5.1.20.0070.02610.70
5.1.10.0040.02510.70
5.1.00.0030.01510.70
5.0.50.0030.02010.70
5.0.40.0040.02410.70
5.0.30.0020.02210.70
5.0.20.0020.02510.70
5.0.10.0030.02210.70
5.0.00.0050.02810.70
4.4.90.0040.01710.70
4.4.80.0020.00710.70
4.4.70.0000.02010.70
4.4.60.0000.01710.70
4.4.50.0020.01710.70
4.4.40.0070.02510.70
4.4.30.0050.01810.70
4.4.20.0020.01810.70
4.4.10.0030.01010.70
4.4.00.0020.03010.70
4.3.110.0020.01310.70
4.3.100.0020.01810.70
4.3.90.0030.01810.70
4.3.80.0020.02510.70
4.3.70.0030.01510.70
4.3.60.0030.01310.70
4.3.50.0030.01710.70
4.3.40.0010.02310.70
4.3.30.0030.01210.70
4.3.20.0050.01010.70
4.3.10.0020.01710.70
4.3.00.0020.01810.70

preferences:
100.22 ms | 400 KiB | 5 Q