3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Container { protected $items; public function __construct() { $this->items = []; } public function exists($name) { return isset($this->item[$name]); } public function get($name) { if (!isset($this->item[$name])) { throw new RuntimeException('Item "' . $name . '" not found'); } return $this->item[$name]; } public function register($name, $item, $replace = false) { if (isset($this->item[$name]) and $replace === false) { throw new RuntimeException('Item "' . $name . '" already exists'); } $this->item[$name] = $item; return $this; } public function unregister($name) { if (!isset($this->item[$name])) { throw new RuntimeException('Item "' . $name . '" not found'); } unset($this->item[$name]); } } $container = new Container(); $container->register('ultimate.question', new class(42) { private $value; public function __construct($value) { $this->value = $value; } public function value() { return $this->value; } }); ; if ($container->exists('ultimate.question')) { $answer = $container->get('ultimate.question'); echo "The answer is: ", $answer->value(), "\n"; $container->unregister('ultimate.question'); } else { echo "Come back in 7,500,000 years\n"; }

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.0150.00616.88
8.3.50.0100.01018.05
8.3.40.0110.00318.89
8.3.30.0060.00918.92
8.3.20.0050.00320.21
8.3.10.0080.00023.70
8.3.00.0030.00619.51
8.2.180.0000.01818.41
8.2.170.0070.01322.96
8.2.160.0110.00720.40
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00417.63
8.2.120.0080.00026.35
8.2.110.0030.01522.14
8.2.100.0040.00718.05
8.2.90.0030.00619.21
8.2.80.0000.00817.97
8.2.70.0000.00817.63
8.2.60.0060.00318.16
8.2.50.0040.00418.07
8.2.40.0000.00819.14
8.2.30.0050.00320.65
8.2.20.0040.00417.68
8.2.10.0050.00318.07
8.2.00.0070.00018.13
8.1.280.0100.00725.92
8.1.270.0080.00023.98
8.1.260.0050.00328.09
8.1.250.0040.00428.09
8.1.240.0090.00022.59
8.1.230.0080.00417.76
8.1.220.0040.00417.74
8.1.210.0090.00318.77
8.1.200.0060.00317.25
8.1.190.0030.00617.23
8.1.180.0030.00618.10
8.1.170.0040.00418.78
8.1.160.0020.00521.94
8.1.150.0000.00818.86
8.1.140.0030.00519.60
8.1.130.0000.00717.72
8.1.120.0000.00717.48
8.1.110.0040.00417.38
8.1.100.0040.00417.40
8.1.90.0000.00817.49
8.1.80.0030.00617.52
8.1.70.0000.00717.40
8.1.60.0040.00417.48
8.1.50.0040.00417.61
8.1.40.0000.00817.57
8.1.30.0060.00617.63
8.1.20.0040.00417.57
8.1.10.0000.00917.57
8.1.00.0000.00717.46
8.0.300.0050.00318.77
8.0.290.0000.00716.75
8.0.280.0000.00718.51
8.0.270.0000.00717.29
8.0.260.0070.00017.26
8.0.250.0000.00716.87
8.0.240.0070.00016.91
8.0.230.0000.00717.00
8.0.220.0000.00716.84
8.0.210.0000.00816.91
8.0.200.0060.00016.84
8.0.190.0040.00416.83
8.0.180.0030.00616.90
8.0.170.0000.00716.95
8.0.160.0040.00416.82
8.0.150.0030.00416.75
8.0.140.0070.00016.78
8.0.130.0000.00613.30
8.0.120.0030.00616.77
8.0.110.0000.00816.79
8.0.100.0040.00416.95
8.0.90.0000.00716.71
8.0.80.0040.01216.96
8.0.70.0040.00416.95
8.0.60.0000.00716.77
8.0.50.0030.00616.94
8.0.30.0090.01117.29
8.0.20.0140.00717.40
8.0.10.0040.00416.93
8.0.00.0070.01216.84
7.4.330.0060.00015.08
7.4.320.0000.00616.61
7.4.300.0000.00616.43
7.4.290.0040.00416.63
7.4.280.0040.00416.61
7.4.270.0030.00316.67
7.4.260.0030.00316.60
7.4.250.0000.00816.63
7.4.240.0050.00216.59
7.4.230.0030.00316.65
7.4.220.0120.00816.46
7.4.210.0030.01016.71
7.4.200.0040.00416.66
7.4.160.0090.00616.55
7.4.150.0140.00417.40
7.4.140.0070.01517.86
7.4.130.0100.00916.68
7.4.120.0070.01416.67
7.4.110.0140.00516.56
7.4.100.0110.01116.34
7.4.90.0090.01516.59
7.4.80.0030.01319.39
7.4.70.0110.00816.69
7.4.60.0100.00616.42
7.4.50.0030.01416.51
7.4.40.0160.00616.32
7.4.30.0090.00916.43
7.4.00.0100.00314.81
7.3.330.0030.00313.24
7.3.320.0030.00313.20
7.3.310.0000.00716.34
7.3.300.0020.00516.45
7.3.290.0080.00716.36
7.3.280.0050.01116.33
7.3.270.0200.03717.40
7.3.260.0060.01216.41
7.3.250.0090.01016.36
7.3.240.0120.00516.51
7.3.230.0150.01016.43
7.3.210.0040.01416.39
7.3.200.0120.00416.45
7.3.190.0070.01416.61
7.3.180.0030.01316.48
7.3.170.0090.01316.52
7.3.160.0140.00716.33
7.3.00.0040.01116.64
7.2.330.0060.01316.71
7.2.320.0060.01316.81
7.2.310.0100.00716.87
7.2.300.0070.01016.33
7.2.290.0110.01316.80
7.2.130.0110.00417.09
7.2.120.0060.00917.04
7.2.110.0070.01016.68
7.2.100.0040.01117.14
7.2.90.0130.00616.94
7.2.80.0030.01316.94
7.2.70.0060.01016.97
7.2.60.0080.00516.85
7.2.50.0100.00016.59
7.2.40.0040.00417.01
7.2.30.0030.00716.97
7.2.20.0060.00916.87
7.2.10.0120.00316.99
7.2.00.0050.00918.04
7.1.250.0030.01015.90
7.1.240.0040.01115.67
7.1.230.0040.01115.46
7.1.220.0090.00615.84
7.1.210.0070.00715.71
7.1.200.0050.00715.72
7.1.190.0070.00715.86
7.1.180.0060.00915.55
7.1.170.0100.00715.77
7.1.160.0100.00315.73
7.1.150.0000.01415.59
7.1.140.0060.00315.94
7.1.130.0000.01215.90
7.1.120.0070.00315.77
7.1.110.0130.00315.96
7.1.100.0060.00616.72
7.1.90.0070.00715.86
7.1.80.0030.01115.75
7.1.70.0020.00716.49
7.1.60.0070.01317.54
7.1.50.0070.00916.45
7.1.40.0110.00715.94
7.1.30.0040.00915.57
7.1.20.0040.00715.85
7.1.10.0060.00915.71
7.1.00.0060.04019.13
7.0.330.0140.00315.32
7.0.320.0060.00315.12
7.0.310.0160.00015.43
7.0.300.0030.01315.34
7.0.290.0000.01015.49
7.0.280.0140.00015.06
7.0.270.0090.00915.25
7.0.260.0030.00915.04
7.0.250.0030.00614.95
7.0.240.0070.00715.27
7.0.230.0050.00515.20
7.0.220.0070.00715.44
7.0.210.0110.00415.29
7.0.200.0190.00914.94
7.0.190.0170.00015.17
7.0.180.0130.00515.32
7.0.170.0060.01015.57
7.0.160.0060.00315.37
7.0.150.0060.00615.61
7.0.140.0000.00815.43
7.0.130.0030.01415.33
7.0.120.0040.00415.38
7.0.110.0030.00715.32
7.0.100.0070.00715.38
7.0.90.0000.01015.26
7.0.80.0060.00315.48
7.0.70.0060.00615.05
7.0.60.0080.04217.73
7.0.50.0070.03516.55
7.0.40.0090.03116.73
7.0.30.0130.04316.71
7.0.20.0080.03316.85
7.0.10.0080.04316.83
7.0.00.0070.04316.68
5.6.380.0060.00714.42
5.6.370.0030.00914.17
5.6.360.0070.00714.26
5.6.350.0110.00314.30
5.6.340.0090.00613.66
5.6.330.0110.00414.12
5.6.320.0110.00313.54
5.6.310.0130.00313.98
5.6.300.0040.01114.28
5.6.290.0030.01013.95
5.6.280.0060.01917.31
5.6.270.0000.01513.90
5.6.260.0000.01014.06
5.6.250.0060.00613.94
5.6.240.0040.00814.30
5.6.230.0070.00714.33
5.6.220.0030.01014.20
5.6.210.0070.03117.36
5.6.200.0090.04116.15
5.6.190.0080.02417.34
5.6.180.0250.03517.25
5.6.170.0190.03217.45
5.6.160.0050.02817.43
5.6.150.0100.03316.02
5.6.140.0110.03116.08
5.6.130.0100.03616.13
5.6.120.0080.04217.59
5.6.110.0080.04317.32
5.6.100.0050.04817.49
5.6.90.0030.05017.56
5.6.80.0050.04617.14
5.6.70.0030.00713.94
5.6.60.0000.01313.83
5.6.50.0060.00613.86
5.6.40.0030.00513.82
5.6.30.0030.00513.75
5.6.20.0050.00513.97
5.6.10.0060.00613.78
5.6.00.0100.00013.79
5.5.380.0060.00310.90
5.5.370.0040.00411.10
5.5.360.0040.00410.90
5.5.350.0200.03515.67
5.5.340.0070.01914.44
5.5.330.0020.02415.78
5.5.320.0050.03215.69
5.5.310.0140.03615.72
5.5.300.0020.04514.46
5.5.290.0070.03414.44
5.5.280.0050.02515.89
5.5.270.0070.04215.84
5.5.260.0080.04015.85
5.5.250.0020.02815.69
5.5.240.0160.03515.59
5.5.230.0000.01210.90
5.5.220.0040.00710.90
5.5.210.0000.00610.90
5.5.200.0060.00310.90
5.5.190.0030.00310.90
5.5.180.0050.00210.90
5.5.170.0060.00310.90
5.5.160.0070.00310.90
5.5.150.0040.00410.90
5.5.140.0040.00410.90
5.5.130.0000.01010.90
5.5.120.0030.00610.90
5.5.110.0030.00510.90
5.5.100.0080.00010.90
5.5.90.0000.01210.90
5.5.80.0000.00710.90
5.5.70.0000.00810.90
5.5.60.0030.00510.90
5.5.50.0000.00610.90
5.5.40.0050.00310.90
5.5.30.0060.00310.90
5.5.20.0040.00410.90
5.5.10.0030.00310.90
5.5.00.0060.00010.90

preferences:
52.99 ms | 400 KiB | 5 Q