3v4l.org

run code in 300+ PHP versions simultaneously
<?php class hello { public $props = array(); function __construct() { $this->props = ['hello' => 5, 'props' => ['keyme' => ['test' => 5]]]; } } $data = new hello(); $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($data), RecursiveIteratorIterator::SELF_FIRST); echo "Expect to see all keys in ->props here: \n"; foreach($iterator as $k=>$v) { echo $k . "\n"; } echo "Reimplemented RecursiveArrayIterator from source code here: http://fossies.org/dox/php-7.0.11-src/recursivearrayiterator_8inc_source.html \n"; class RecursiveArray extends ArrayIterator implements RecursiveIterator { function hasChildren() { return is_array($this->current()); } function getChildren() { if ($this->current() instanceof self) { return $this->current(); } if (empty($this->ref)) { $this->ref = new ReflectionClass($this); } return $this->ref->newInstance($this->current()); } private $ref; } $iterator = new RecursiveIteratorIterator(new RecursiveArray($data), RecursiveIteratorIterator::SELF_FIRST); echo "Expect to see all keys in ->props here: \n"; foreach($iterator as $k=>$v) { echo $k . "\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.0090.01316.63
8.3.50.0110.00921.21
8.3.40.0150.00018.87
8.3.30.0090.00618.80
8.3.20.0000.00820.25
8.3.10.0090.00020.50
8.3.00.0000.00823.48
8.2.180.0070.00716.75
8.2.170.0140.00719.02
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0030.00524.66
8.2.130.0060.00321.11
8.2.120.0050.00326.35
8.2.110.0030.00622.20
8.2.100.0000.01117.72
8.2.90.0050.00517.78
8.2.80.0040.00419.11
8.2.70.0040.00417.50
8.2.60.0040.00417.63
8.2.50.0040.00417.79
8.2.40.0040.00419.36
8.2.30.0000.00719.32
8.2.20.0000.00717.98
8.2.10.0000.00818.03
8.2.00.0040.00417.72
8.1.280.0120.00325.92
8.1.270.0060.00324.66
8.1.260.0150.00328.09
8.1.250.0000.00728.09
8.1.240.0100.00022.15
8.1.230.0080.00420.90
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0030.00617.65
8.1.190.0030.00517.10
8.1.180.0000.01218.10
8.1.170.0000.00817.62
8.1.160.0090.00022.18
8.1.150.0000.00718.86
8.1.140.0040.00419.59
8.1.130.0080.00017.53
8.1.120.0030.00517.56
8.1.110.0050.00317.33
8.1.100.0000.00717.48
8.1.90.0040.00417.48
8.1.80.0070.00017.46
8.1.70.0070.00017.41
8.1.60.0080.00017.52
8.1.50.0000.00817.60
8.1.40.0030.00617.47
8.1.30.0000.00917.54
8.1.20.0070.00017.66
8.1.10.0040.00417.59
8.1.00.0000.00817.57
8.0.300.0070.00020.21
8.0.290.0100.00016.88
8.0.280.0040.00418.48
8.0.270.0030.00316.81
8.0.260.0000.00716.87
8.0.250.0030.00316.91
8.0.240.0030.00316.98
8.0.230.0050.00316.98
8.0.220.0060.00016.94
8.0.210.0070.00017.00
8.0.200.0000.00716.92
8.0.190.0030.00616.96
8.0.180.0000.00716.92
8.0.170.0000.00816.99
8.0.160.0000.00716.97
8.0.150.0000.00716.84
8.0.140.0040.00416.92
8.0.130.0000.00513.36
8.0.120.0000.00816.89
8.0.110.0050.00216.76
8.0.100.0030.00516.94
8.0.90.0000.00717.00
8.0.80.0120.00916.93
8.0.70.0030.00616.93
8.0.60.0040.00416.83
8.0.50.0000.00716.96
8.0.30.0090.01117.33
8.0.20.0060.01217.40
8.0.10.0050.00317.11
8.0.00.0210.00616.67
7.4.330.0050.00015.16
7.4.320.0000.00616.46
7.4.300.0030.00316.66
7.4.290.0070.00016.61
7.4.280.0040.00416.59
7.4.270.0030.00316.55
7.4.260.0000.00716.58
7.4.250.0040.00416.64
7.4.240.0050.00316.57
7.4.230.0070.00016.64
7.4.220.0030.00316.75
7.4.210.0060.01016.61
7.4.200.0000.00716.75
7.4.160.0050.01116.55
7.4.150.0080.01017.40
7.4.140.0090.01617.86
7.4.130.0130.00416.54
7.4.120.0130.00416.46
7.4.110.0100.01316.48
7.4.100.0090.00916.38
7.4.90.0090.00816.64
7.4.80.0070.01019.39
7.4.70.0110.00616.71
7.4.60.0060.01116.66
7.4.50.0140.00316.39
7.4.40.0030.01416.60
7.4.30.0070.01016.79
7.4.00.0110.00714.95
7.3.330.0060.00013.20
7.3.320.0030.00313.16
7.3.310.0030.00516.29
7.3.300.0070.00016.22
7.3.290.0030.00316.21
7.3.280.0090.00916.33
7.3.270.0080.01217.40
7.3.260.0030.01416.58
7.3.250.0110.00616.42
7.3.240.0120.00716.45
7.3.230.0060.01216.48
7.3.210.0130.00616.75
7.3.200.0140.00316.68
7.3.190.0090.00616.52
7.3.180.0090.01216.67
7.3.170.0110.00716.65
7.3.160.0140.00716.34
7.3.10.0060.01016.59
7.3.00.0070.00716.63
7.2.330.0070.01016.80
7.2.320.0160.00316.50
7.2.310.0040.01216.80
7.2.300.0070.01516.61
7.2.290.0130.00316.89
7.2.130.0030.01017.11
7.2.120.0000.01316.71
7.2.110.0060.00316.77
7.2.100.0000.01117.14
7.2.90.0060.00316.80
7.2.80.0030.01016.99
7.2.70.0090.00616.79
7.2.60.0050.00317.05
7.2.50.0070.00316.85
7.2.40.0000.01216.69
7.2.30.0000.00916.95
7.2.20.0070.00717.02
7.2.10.0100.00316.85
7.2.00.0100.00317.04
7.1.250.0040.00415.71
7.1.240.0030.00615.72
7.1.230.0000.01315.83
7.1.220.0030.00615.89
7.1.210.0030.01015.87
7.1.200.0080.00315.88
7.1.190.0030.01215.78
7.1.180.0060.00615.80
7.1.170.0080.00415.88
7.1.160.0070.00715.62
7.1.150.0060.00616.04
7.1.140.0040.00415.62
7.1.130.0030.01315.64
7.1.120.0090.00015.83
7.1.110.0060.00615.67
7.1.100.0040.01115.76
7.1.90.0090.00615.59
7.1.80.0030.00615.75
7.1.70.0050.00516.46
7.1.60.0120.00316.54
7.1.50.0090.00716.16
7.1.40.0070.00715.67
7.1.30.0030.01015.53
7.1.20.0040.00815.89
7.1.10.0090.00615.93
7.1.00.0050.04219.11
7.0.330.0060.00315.32
7.0.320.0060.00615.50
7.0.310.0060.00615.24
7.0.300.0000.01215.29
7.0.290.0090.00615.41
7.0.280.0090.00315.37
7.0.270.0060.00615.13
7.0.260.0030.01015.19
7.0.250.0030.00615.25
7.0.240.0040.00715.50
7.0.230.0030.01015.28
7.0.220.0030.00615.40
7.0.210.0100.00315.42
7.0.200.0030.01216.12
7.0.190.0040.00915.44
7.0.180.0000.00715.29
7.0.170.0070.00315.57
7.0.160.0070.00315.45
7.0.150.0000.00815.43
7.0.140.0070.00315.47
7.0.130.0070.00415.54
7.0.120.0110.00315.44
7.0.110.0140.02717.87
7.0.100.0060.03017.83
7.0.90.0030.03617.90
7.0.80.0040.03517.75
7.0.70.0050.04017.85
7.0.60.0080.03317.87
7.0.50.0080.03317.92
7.0.40.0250.03016.89
7.0.30.0250.03316.95
7.0.20.0220.03216.84
7.0.10.0230.03216.95
7.0.00.0150.03216.90
5.6.380.0100.00314.18
5.6.370.0080.00414.36
5.6.360.0000.01314.27
5.6.350.0040.01114.55
5.6.340.0060.00914.20
5.6.330.0090.00914.25
5.6.320.0030.01014.02
5.6.310.0040.01114.26
5.6.300.0090.00014.49
5.6.290.0090.00014.61
5.6.280.0060.00614.26
5.6.270.0000.00714.32
5.6.260.0060.03317.64
5.6.250.0090.03217.68
5.6.240.0080.03017.73
5.6.230.0070.03217.65
5.6.220.0120.03217.67
5.6.210.0110.02917.80
5.6.200.0100.03217.54
5.6.190.0100.03317.58
5.6.180.0090.03217.52
5.6.170.0140.02817.77
5.6.160.0110.03017.89
5.6.150.0110.03017.52
5.6.140.0060.03117.49
5.6.130.0050.03217.58
5.6.120.0100.03217.52
5.6.110.0070.03217.51
5.6.100.0090.03217.52
5.6.90.0100.03217.62
5.6.80.0050.03017.08
5.6.70.0130.02517.44
5.6.60.0060.03517.27
5.6.50.0070.02917.41
5.6.40.0120.03017.33
5.6.30.0050.03717.38
5.6.20.0070.04417.29
5.6.10.0090.03917.24
5.6.00.0080.03217.15

preferences:
57.84 ms | 401 KiB | 5 Q