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('request1', function(){ return new Request(); }); //Using an anonymous function $di->set('request2', 'Request'); var_dump($di->get('request1'));

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.28
8.3.50.0240.01021.95
8.3.40.0120.00618.97
8.3.30.0100.00319.08
8.3.20.0040.00420.29
8.3.10.0040.00421.71
8.3.00.0030.00519.50
8.2.180.0090.00616.63
8.2.170.0070.00722.96
8.2.160.0040.01420.57
8.2.150.0120.00324.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0060.00322.21
8.2.110.0040.00419.20
8.2.100.0070.00717.97
8.2.90.0000.00919.21
8.2.80.0030.00517.97
8.2.70.0000.00817.75
8.2.60.0040.00418.16
8.2.50.0000.00818.10
8.2.40.0030.00520.45
8.2.30.0050.00218.25
8.2.20.0040.00417.91
8.2.10.0040.00418.16
8.2.00.0000.00817.98
8.1.280.0090.00625.92
8.1.270.0050.00322.19
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0090.00023.97
8.1.230.0070.00319.12
8.1.220.0000.00817.77
8.1.210.0050.00318.77
8.1.200.0030.00617.25
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0050.00318.59
8.1.160.0070.00022.13
8.1.150.0000.00818.95
8.1.140.0040.00417.48
8.1.130.0050.00317.93
8.1.120.0030.00317.52
8.1.110.0040.00417.47
8.1.100.0040.00417.39
8.1.90.0050.00217.41
8.1.80.0000.00717.51
8.1.70.0000.00717.49
8.1.60.0040.00417.65
8.1.50.0000.00817.48
8.1.40.0000.00817.61
8.1.30.0080.00017.68
8.1.20.0060.00317.67
8.1.10.0000.00717.51
8.1.00.0030.00717.45
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.49
8.0.270.0000.00717.21
8.0.260.0030.00317.17
8.0.250.0030.00316.96
8.0.240.0070.00017.07
8.0.230.0000.00717.02
8.0.220.0030.00316.87
8.0.210.0030.00316.86
8.0.200.0030.00317.02
8.0.190.0050.00317.07
8.0.180.0050.00316.92
8.0.170.0040.00417.04
8.0.160.0040.00417.07
8.0.150.0050.00316.88
8.0.140.0000.00716.82
8.0.130.0030.00313.46
8.0.120.0000.00716.89
8.0.110.0040.00416.99
8.0.100.0000.00716.94
8.0.90.0000.00717.06
8.0.80.0040.01116.88
8.0.70.0050.00317.03
8.0.60.0050.00316.77
8.0.50.0070.00016.87
8.0.30.0080.01217.18
8.0.20.0090.01017.40
8.0.10.0030.00517.14
8.0.00.0120.00916.77
7.4.330.0050.00015.02
7.4.320.0060.00016.66
7.4.300.0000.00616.52
7.4.290.0030.00316.47
7.4.280.0040.00416.55
7.4.270.0060.00016.63
7.4.260.0040.00416.54
7.4.250.0090.00016.52
7.4.240.0000.00716.59
7.4.230.0070.00016.43
7.4.220.0110.00716.67
7.4.210.0030.01016.53
7.4.200.0000.00716.63
7.4.160.0090.01216.75
7.4.150.0090.01517.40
7.4.140.0100.00717.86
7.4.130.0090.00916.72
7.4.120.0090.01016.62
7.4.110.0090.00916.81
7.4.100.0100.00716.50
7.4.90.0040.01516.63
7.4.80.0110.00919.39
7.4.70.0080.00916.32
7.4.60.0080.01016.66
7.4.50.0080.00016.73
7.4.40.0100.00716.61
7.4.30.0070.01016.63
7.4.00.0090.00914.79
7.3.330.0050.00013.46
7.3.320.0000.00513.49
7.3.310.0050.00316.56
7.3.300.0000.00716.32
7.3.290.0060.01016.47
7.3.280.0090.00916.46
7.3.270.0060.01217.40
7.3.260.0120.00616.47
7.3.250.0050.01116.57
7.3.240.0100.00716.68
7.3.230.0030.01416.46
7.3.210.0070.01016.53
7.3.200.0060.01619.39
7.3.190.0090.01516.41
7.3.180.0160.00016.64
7.3.170.0140.00316.39
7.3.160.0080.00816.56
7.3.120.0100.00314.86
7.3.110.0120.00314.93
7.3.100.0090.00314.50
7.3.90.0080.00415.04
7.3.80.0080.00814.63
7.3.70.0030.01014.70
7.3.60.0000.01014.47
7.3.50.0030.01014.73
7.3.40.0060.00814.55
7.3.30.0100.00314.45
7.3.20.0030.01016.75
7.3.10.0080.00416.64
7.3.00.0070.00616.73
7.2.330.0120.00616.82
7.2.320.0100.00716.68
7.2.310.0110.00716.48
7.2.300.0060.01216.80
7.2.290.0160.00716.55
7.2.240.0090.00915.00
7.2.230.0060.00615.09
7.2.220.0000.01814.60
7.2.210.0090.00915.04
7.2.200.0030.01215.00
7.2.190.0120.00614.72
7.2.180.0060.00314.81
7.2.170.0060.00914.81
7.2.160.0060.00714.88
7.2.150.0040.00816.97
7.2.140.0090.00316.92
7.2.130.0060.00816.96
7.2.120.0110.00616.85
7.2.110.0070.00816.89
7.2.100.0080.00816.95
7.2.90.0040.01216.97
7.2.80.0110.01016.90
7.2.70.0110.00816.81
7.2.60.0120.00916.73
7.2.50.0120.00816.87
7.2.40.0140.00816.96
7.2.30.0090.01016.97
7.2.20.0090.00816.80
7.2.10.0100.00516.92
7.2.00.0100.00917.47
7.1.330.0110.00415.77
7.1.320.0100.00715.80
7.1.310.0100.00315.41
7.1.300.0090.00315.59
7.1.290.0060.00915.81
7.1.280.0040.01015.72
7.1.270.0070.00715.74
7.1.260.0100.00015.65
7.1.250.0040.00815.76
7.1.240.0130.00215.78
7.1.230.0040.00915.77
7.1.220.0010.01115.81
7.1.210.0070.00615.60
7.1.200.0040.01115.79
7.1.190.0080.00715.59
7.1.180.0070.00915.68
7.1.170.0090.00615.84
7.1.160.0040.00915.79
7.1.150.0030.00915.80
7.1.140.0030.00915.89
7.1.130.0080.00515.99
7.1.120.0050.00915.79
7.1.110.0060.00615.74
7.1.100.0050.00816.61
7.1.90.0050.00715.85
7.1.80.0070.00715.79
7.1.70.0050.00516.35
7.1.60.0040.01316.87
7.1.50.0050.01116.22
7.1.40.0030.00615.76
7.1.30.0040.00915.78
7.1.20.0050.00715.73
7.1.10.0020.00615.78
7.1.00.0020.03017.98
7.0.330.0100.00615.23
7.0.320.0050.00715.40
7.0.310.0120.00315.31
7.0.300.0040.01215.17
7.0.290.0070.00815.21
7.0.280.0050.00915.28
7.0.270.0080.00415.40
7.0.260.0070.00715.21
7.0.250.0020.00915.55
7.0.240.0050.00815.42
7.0.230.0060.00715.10
7.0.220.0070.00515.36
7.0.210.0030.01015.17
7.0.200.0040.00815.88
7.0.190.0080.00615.44
7.0.180.0050.00715.33
7.0.170.0070.00715.33
7.0.160.0070.00715.33
7.0.150.0060.00815.52
7.0.140.0040.02817.66
7.0.130.0040.00715.45
7.0.120.0040.00715.48
7.0.110.0030.00815.51
7.0.100.0040.00815.41
7.0.90.0050.00515.32
7.0.80.0040.01015.49
7.0.70.0070.00715.33
7.0.60.0070.02216.95
7.0.50.0030.03216.21
7.0.40.0060.02115.64
7.0.30.0090.02615.70
7.0.20.0110.03315.54
7.0.10.0050.03315.68
7.0.00.0080.03115.80
5.6.380.0110.00314.46
5.6.370.0070.00514.32
5.6.360.0050.00614.41
5.6.350.0030.00914.31
5.6.340.0080.00314.36
5.6.330.0060.00414.67
5.6.320.0070.00514.15
5.6.310.0050.00514.55
5.6.300.0050.00714.46
5.6.290.0020.01014.39
5.6.280.0030.03316.63
5.6.270.0060.00614.58
5.6.260.0060.00514.34
5.6.250.0030.00814.24
5.6.240.0080.00514.41
5.6.230.0110.00214.38
5.6.220.0030.01014.27
5.6.210.0120.01216.55
5.6.200.0090.02915.75
5.6.190.0030.02116.51
5.6.180.1430.01516.30
5.6.170.0090.02016.36
5.6.160.0090.03016.40
5.6.150.0080.02315.80
5.6.140.0060.02115.82
5.6.130.0070.02615.68
5.6.120.0040.03416.66
5.6.110.0040.02816.66
5.6.100.0100.02116.56
5.6.90.0090.02916.63
5.6.80.0060.03116.31
5.6.70.1500.01716.48
5.6.60.0040.00814.47
5.6.50.0050.00814.38
5.6.40.0050.00714.45
5.6.30.0070.00614.29
5.6.20.0040.00914.37
5.6.10.0060.00714.26
5.6.00.0030.01014.39
5.5.380.0040.00511.20
5.5.370.0050.00311.11
5.5.360.0050.00411.22
5.5.350.0030.03014.27
5.5.340.0080.02613.42
5.5.330.0030.02214.33
5.5.320.1140.01814.29
5.5.310.0090.01614.26
5.5.300.0010.02113.52
5.5.290.0030.01813.50
5.5.280.0080.03114.49
5.5.270.0050.03114.38
5.5.260.0060.02814.45
5.5.250.0030.02914.22
5.5.240.0080.03114.20
5.5.230.0040.00411.20
5.5.220.0020.00711.16
5.5.210.0030.00511.29
5.5.200.0050.00511.18
5.5.190.0040.00311.29
5.5.180.0020.00611.12
5.5.170.0010.00511.30
5.5.160.0030.00311.26
5.5.150.0060.00011.27
5.5.140.0060.00511.15
5.5.130.0010.01011.03
5.5.120.0030.00511.14
5.5.110.0030.00411.13
5.5.100.0020.00611.23
5.5.90.0020.00511.04
5.5.80.0050.00411.25
5.5.70.0060.00311.09
5.5.60.0030.00510.99
5.5.50.0030.00511.09
5.5.40.0040.00611.02
5.5.30.0050.00511.33
5.5.20.0030.00611.28
5.5.10.0050.00511.12
5.5.00.0020.00811.19
5.4.450.0070.02713.90
5.4.440.0090.02913.91
5.4.430.0240.02914.16
5.4.420.0330.00113.93
5.4.410.0230.00313.91
5.4.400.0230.00313.74
5.4.390.0230.00413.74
5.4.380.0250.00313.82
5.4.370.0240.00213.79
5.4.360.0250.00313.92
5.4.350.0270.00213.79
5.4.340.0070.01311.37
5.4.330.0050.00611.29
5.4.320.0070.01311.54
5.4.310.0040.01711.60
5.4.300.0040.01611.62
5.4.290.0020.01811.60
5.4.280.0080.01211.56
5.4.270.0060.01311.66
5.4.260.0050.01511.61
5.4.250.0050.01411.48
5.4.240.0040.01511.53
5.4.230.0040.01611.53
5.4.220.0050.01411.48
5.4.210.0050.01411.62
5.4.200.0040.01711.54
5.4.190.0040.01411.48
5.4.180.0070.01311.65
5.4.170.0060.01411.51
5.4.160.0060.01311.50
5.4.150.0080.01211.53
5.4.140.0040.01711.48
5.4.130.0070.01411.45
5.4.120.0040.01711.42
5.4.110.0070.01611.40
5.4.100.0010.01711.46
5.4.90.0040.01511.47
5.4.80.0050.01511.49
5.4.70.0040.01711.44
5.4.60.0040.01611.46
5.4.50.0040.01611.34
5.4.40.0060.01311.46
5.4.30.0030.01711.43
5.4.20.0050.01511.42
5.4.10.0040.01511.52
5.4.00.0040.01611.32
5.3.290.0050.01511.36
5.3.280.0050.01511.29
5.3.270.0030.01811.40
5.3.260.0070.01811.39
5.3.250.0040.01811.41
5.3.240.0040.01811.37
5.3.230.0030.01811.28
5.3.220.0050.01511.36
5.3.210.0070.01611.35
5.3.200.0050.01611.35
5.3.190.0050.01611.40
5.3.180.0040.01511.43
5.3.170.0070.01311.46
5.3.160.0030.01711.37
5.3.150.0050.01511.41
5.3.140.0060.01311.39
5.3.130.0030.01711.36
5.3.120.0040.01611.36
5.3.110.0040.01511.39
5.3.100.0030.01611.21
5.3.90.0030.01511.26
5.3.80.0020.01911.17
5.3.70.0040.01611.20
5.3.60.0050.01511.19
5.3.50.0030.01611.10
5.3.40.0040.01611.15
5.3.30.0030.01611.04
5.3.20.0020.01611.06
5.3.10.0030.01510.92
5.3.00.0040.01410.98
5.2.170.0050.0129.94
5.2.160.0050.0119.93
5.2.150.0060.0189.93
5.2.140.0040.0129.93
5.2.130.0060.0129.92
5.2.120.0050.0149.92
5.2.110.0040.0159.92
5.2.100.0050.0109.92
5.2.90.0030.0149.92
5.2.80.0030.0139.92
5.2.70.0040.0139.92
5.2.60.0030.0139.91
5.2.50.0050.0129.90
5.2.40.0040.0119.89
5.2.30.0020.0149.88
5.2.20.0040.0139.88
5.2.10.0040.0129.84
5.2.00.0030.0129.80
5.1.60.0020.0119.56
5.1.50.0030.0119.56
5.1.40.0030.0109.55
5.1.30.0040.0119.67
5.1.20.0020.0139.68
5.1.10.0030.0099.59
5.1.00.0050.0099.59
5.0.50.0050.0089.08
5.0.40.0030.0119.03
5.0.30.0060.0138.97
5.0.20.0030.0108.96
5.0.10.0010.0128.95
5.0.00.0040.0108.95
4.4.90.0020.0098.46
4.4.80.0040.0058.45
4.4.70.0020.0068.45
4.4.60.0020.0068.45
4.4.50.0030.0078.45
4.4.40.0050.0088.43
4.4.30.0030.0088.45
4.4.20.0030.0078.48
4.4.10.0050.0058.48
4.4.00.0010.0138.45
4.3.110.0010.0108.42
4.3.100.0030.0068.42
4.3.90.0020.0088.41
4.3.80.0010.0138.39
4.3.70.0030.0078.41
4.3.60.0030.0088.40
4.3.50.0020.0098.40
4.3.40.0010.0118.38
4.3.30.0020.0077.96
4.3.20.0020.0067.96
4.3.10.0010.0097.94
4.3.00.0020.0109.49

preferences:
44.12 ms | 401 KiB | 5 Q