3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Enter your code here, enjoy! $array = array("1" => "PHP code tester Sandbox Online", "foo" => "bar", 5 , 5 => 89009, "case" => "Random Stuff", "PHP Version" => phpversion() ); /** * Config class * * Simple class to store or get elements from configuration registry */ class Config implements \IteratorAggregate { /** @var array $data Data configuration array */ private $data = []; /** * Class constructor * @param array $data List of values to add to the configuration registry */ public function __construct(array $data = []) { $ritit = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($data)); $result = array(); foreach ($ritit as $leafValue) { $keys = array(); foreach (range(0, $ritit->getDepth()) as $depth) { $keys[] = $ritit->getSubIterator($depth)->key(); } $result[implode('.', $keys)] = $leafValue; } $this->data = $result; } /** * Retrieves elements from config array * * @param string $key * @return mixed returns a config value * @throws Exception when no $key found */ public function get($key) { if (!isset($this->data[$key])) { throw new \Exception('There is no entry for key: ' . $key); } return $this->data[$key]; } /** * Return true if value is empty for given key * * @param string $key * @return bool */ public function isEmpty($key) { return empty($this->data[$key]); } /** * IteratorAggregate interface required method * * @return \ArrayIterator */ public function getIterator() { return new \ArrayIterator($this->data); } } $config = new Config($array); var_dump($config->dotnot());

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)
7.4.00.0100.00914.98
7.3.120.0110.00715.02
7.3.110.0150.00315.13
7.3.100.0160.00315.16
7.3.90.0070.01014.91
7.3.80.0110.00314.68
7.3.70.0040.01114.70
7.3.60.0000.00814.64
7.3.50.0090.00314.98
7.3.40.0100.00614.91
7.3.30.0080.00414.65
7.3.20.0000.01116.77
7.3.10.0080.00616.50
7.3.00.0060.01116.67
7.2.250.0030.01715.05
7.2.240.0040.01215.05
7.2.230.0180.00015.22
7.2.220.0030.01015.15
7.2.210.0060.00915.06
7.2.200.0000.00915.30
7.2.190.0030.00615.26
7.2.180.0060.01214.95
7.2.170.0110.00714.82
7.2.130.0080.00816.79
7.2.120.0090.00916.73
7.2.110.0070.01116.83
7.2.100.0060.00616.78
7.2.90.0100.00317.00
7.2.80.0090.00916.74
7.2.70.0180.00416.87
7.2.60.0100.01316.72
7.2.50.0000.01716.69
7.2.40.0110.01116.31
7.2.30.0090.00616.56
7.2.20.0080.01116.87
7.2.10.0160.00916.29
7.2.00.0100.00718.08
7.1.330.0000.01215.79
7.1.320.0070.00415.96
7.1.310.0080.00815.56
7.1.300.0000.01215.87
7.1.290.0030.00915.60
7.1.280.0070.01115.94
7.1.270.0060.00315.80
7.1.260.0130.00015.59
7.1.250.0030.01415.41
7.1.100.0030.00918.07
7.1.70.0000.00717.23
7.1.60.0120.00319.50
7.1.50.0070.01416.70
7.1.00.0100.07022.34
7.0.200.0050.00316.53
7.0.100.0070.04719.95
7.0.90.0030.05319.84
7.0.80.0100.04319.95
7.0.70.0070.06019.98
7.0.60.0000.04019.94
7.0.50.0230.03320.31
7.0.40.0070.04320.07
7.0.30.0000.06020.14
7.0.20.0070.06320.09
7.0.10.0100.07320.04
7.0.00.0030.07320.07
5.6.280.0000.05321.14
5.6.250.0100.03720.67
5.6.240.0070.04720.68
5.6.230.0000.08320.58
5.6.220.0100.03720.56
5.6.210.0070.05720.62
5.6.200.0000.04720.97
5.6.190.0000.04721.05
5.6.180.0000.04321.04
5.6.170.0030.04721.08
5.6.160.0100.08321.03
5.6.150.0170.07021.12
5.6.140.0100.07721.11
5.6.130.0130.08021.02
5.6.120.0130.07720.96
5.6.110.0070.08321.11
5.6.100.0070.08020.94
5.6.90.0130.08321.09
5.6.80.0170.03720.36
5.6.70.0070.08320.42
5.6.60.0170.07320.30
5.6.50.0100.08020.51
5.6.40.0100.07720.47
5.6.30.0170.06720.42
5.6.20.0100.07720.45
5.6.10.0070.05720.31
5.6.00.0030.04720.37
5.5.380.0000.04320.35
5.5.370.0070.04720.34
5.5.360.0000.04720.52
5.5.350.0100.04320.41
5.5.340.0030.04020.74
5.5.330.0070.03720.88
5.5.320.0000.04320.80
5.5.310.0000.07020.77
5.5.300.0130.06320.88
5.5.290.0070.08720.89
5.5.280.0070.08720.93
5.5.270.0070.08020.73
5.5.260.0030.09020.77
5.5.250.0070.07320.75
5.5.240.0130.07720.18
5.5.230.0130.06720.22
5.5.220.0100.08020.30
5.5.210.0100.07720.19
5.5.200.0070.06720.24
5.5.190.0130.07720.28
5.5.180.0030.08720.13
5.5.160.0000.08720.18
5.5.150.0070.04320.11
5.5.140.0070.07020.21
5.5.130.0100.07020.06
5.5.120.0000.08020.23
5.5.110.0170.06320.23
5.5.100.0170.07020.16
5.5.90.0170.07020.09
5.5.80.0070.08019.96
5.5.70.0030.06720.13
5.5.60.0070.08019.97
5.5.50.0070.08020.09
5.5.40.0100.06020.04
5.5.30.0000.08320.04
5.5.20.0100.08020.09
5.5.10.0130.07320.05
5.5.00.0100.06719.97

preferences:
38.03 ms | 400 KiB | 5 Q