3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3', 'key4' => array( 'subkey1' => 'subval1', 'subkey2' => 'subval2', ) ); function walkArray($input) { // Define our output array $output = array( 'keys' => '', 'vals' => '', 'children' => array(), ); // We're looping trough the input array foreach($input AS $key => $value) { // If the current value is an array we reached the next dimension if(is_array($value)) { // So we call walkArray() recursively with our current value // and assign the returned array to a new element in our $output's 'children' key $output['children'][] = walkArray($value); } else { // We'll concatenate our keys and values... $output['keys'] .= $key . ', '; $output['vals'] .= ':' . $value .', '; } } // And get rid of the trailing commas $output['keys'] = rtrim($output['keys'], ', '); $output['vals'] = rtrim($output['vals'], ', '); // Eventually we return our output array return $output; } print_r(walkArray($arr));

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.0110.00418.30
8.3.50.0130.00621.26
8.3.40.0080.00818.92
8.3.30.0070.00719.22
8.3.20.0040.00420.21
8.3.10.0000.00823.57
8.3.00.0050.00319.38
8.2.180.0120.00616.63
8.2.170.0030.01022.96
8.2.160.0070.00720.35
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0040.00422.11
8.2.110.0040.00420.52
8.2.100.0040.00818.09
8.2.90.0040.00419.34
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0000.00817.93
8.2.50.0040.00418.07
8.2.40.0050.00320.07
8.2.30.0000.00718.02
8.2.20.0000.00817.68
8.2.10.0040.00418.10
8.2.00.0000.00917.81
8.1.280.0090.00625.92
8.1.270.0030.00622.12
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0090.00023.88
8.1.230.0060.00619.10
8.1.220.0040.00417.76
8.1.210.0030.00518.77
8.1.200.0030.00617.35
8.1.190.0030.00517.23
8.1.180.0080.00018.10
8.1.170.0040.00418.65
8.1.160.0040.00422.03
8.1.150.0000.00818.76
8.1.140.0000.00717.31
8.1.130.0000.00717.73
8.1.120.0040.00417.40
8.1.110.0000.00717.35
8.1.100.0040.00317.44
8.1.90.0020.00517.46
8.1.80.0040.00417.48
8.1.70.0040.00417.37
8.1.60.0080.00017.41
8.1.50.0040.00417.42
8.1.40.0030.00617.52
8.1.30.0040.00417.63
8.1.20.0000.00917.66
8.1.10.0020.00517.65
8.1.00.0050.00517.52
8.0.300.0030.00518.77
8.0.290.0070.00016.75
8.0.280.0040.00418.41
8.0.270.0000.00717.25
8.0.260.0030.00317.14
8.0.250.0050.00216.95
8.0.240.0040.00417.00
8.0.230.0030.00316.96
8.0.220.0090.00016.84
8.0.210.0000.00716.97
8.0.200.0030.00316.91
8.0.190.0000.00716.95
8.0.180.0000.00816.85
8.0.170.0040.00416.92
8.0.160.0000.00816.99
8.0.150.0000.00716.84
8.0.140.0030.00616.85
8.0.130.0000.00513.25
8.0.120.0030.00516.94
8.0.110.0050.00316.76
8.0.100.0000.00716.91
8.0.90.0040.00416.84
8.0.80.0060.00916.82
8.0.70.0040.00416.80
8.0.60.0000.00816.90
8.0.50.0000.00816.92
8.0.30.0080.01117.20
8.0.20.0110.00917.40
8.0.10.0000.00816.92
8.0.00.0040.01216.95
7.4.330.0000.00515.00
7.4.320.0000.00716.43
7.4.300.0030.00316.58
7.4.290.0070.00016.47
7.4.280.0030.00516.52
7.4.270.0040.00416.50
7.4.260.0040.00416.48
7.4.250.0040.00416.39
7.4.240.0010.00616.46
7.4.230.0000.00816.41
7.4.220.0120.00616.63
7.4.210.0100.01016.56
7.4.200.0000.00716.31
7.4.160.0130.01016.22
7.4.150.0120.00617.40
7.4.140.0120.00717.86
7.4.130.0090.01116.52
7.4.120.0110.00816.58
7.4.110.0030.01416.57
7.4.100.0150.00316.49
7.4.90.0140.00316.63
7.4.80.0130.01019.39
7.4.70.0140.00816.63
7.4.60.0040.01116.28
7.4.50.0020.00216.65
7.4.40.0080.00816.58
7.4.30.0060.00916.59
7.4.00.0040.01115.14
7.3.330.0020.00213.41
7.3.320.0060.00013.36
7.3.310.0000.00716.38
7.3.300.0000.00716.32
7.3.290.0050.00816.38
7.3.280.0070.01116.40
7.3.270.0070.01117.40
7.3.260.0030.01516.30
7.3.250.0110.00616.63
7.3.240.0100.00716.46
7.3.230.0090.01216.39
7.3.210.0080.00816.52
7.3.200.0130.01019.39
7.3.190.0130.01616.61
7.3.180.0070.01016.45
7.3.170.0060.01316.50
7.3.160.0070.01116.42
7.3.10.0070.00716.51
7.3.00.0000.01416.48
7.2.330.0130.00416.63
7.2.320.0030.01316.48
7.2.310.0060.00916.62
7.2.300.0080.00816.50
7.2.290.0130.01016.75
7.2.130.0080.00816.79
7.2.120.0090.00917.02
7.2.110.0060.00916.98
7.2.100.0040.01116.78
7.2.90.0120.00316.98
7.2.80.0080.00617.01
7.2.70.0120.00316.77
7.2.60.0070.01016.87
7.2.50.0060.01016.89
7.2.40.0110.00317.00
7.2.30.0040.01117.00
7.2.20.0040.00816.88
7.2.10.0080.00617.20
7.2.00.0080.00817.01
7.1.250.0030.01015.53
7.1.70.0030.00717.21
7.1.60.0070.01819.11
7.1.50.0200.01334.89
7.1.00.0100.07022.37
7.0.200.0030.00616.85
7.0.140.0070.07022.00
7.0.60.0100.08319.86
7.0.50.0100.03717.88
7.0.40.0000.04720.15
7.0.30.0370.08020.24
7.0.20.0270.06320.03
7.0.10.0200.07720.10
7.0.00.0070.08320.25
5.6.280.0100.07021.10
5.6.210.0200.07020.61
5.6.200.0070.04318.16
5.6.190.0030.04720.41
5.6.180.0200.07320.41
5.6.170.0300.05320.56
5.6.160.0230.05720.52
5.6.150.0130.07318.12
5.6.140.0100.07318.15
5.6.130.0100.05318.13
5.6.120.0000.04720.94
5.6.110.0030.08021.02
5.6.100.0070.08020.99
5.6.90.0030.04321.13
5.6.80.0030.07020.41
5.5.350.0100.08020.53
5.5.340.0070.07317.96
5.5.330.0130.05020.42
5.5.320.0400.05320.32
5.5.310.0300.06720.27
5.5.300.0100.05718.01
5.5.290.0130.06717.96
5.5.280.0100.05320.74
5.5.270.0200.07320.96
5.5.260.0030.08720.68
5.5.250.0070.07020.69
5.5.240.0270.07020.24
5.4.450.0930.06719.48
5.4.440.0130.06019.35
5.4.430.0200.04719.63
5.4.420.0670.00019.48
5.4.410.0730.00019.36
5.4.400.0600.00019.12
5.4.390.0700.00019.11
5.4.380.0630.00019.07
5.4.370.0630.00019.07
5.4.360.0700.00019.02
5.4.350.0830.00019.09
5.4.340.0070.03312.02
5.4.320.0040.03812.50
5.4.310.0060.03812.50
5.4.300.0100.03612.51
5.4.290.0030.04112.50
5.4.280.0090.03212.39
5.4.270.0050.03712.40
5.4.260.0050.04212.40
5.4.250.0070.03612.40
5.4.240.0060.03712.40
5.4.230.0070.03612.39
5.4.220.0050.03812.39
5.4.210.0050.03612.39
5.4.200.0090.03412.39
5.4.190.0110.03012.39
5.4.180.0070.03612.38
5.4.170.0070.03512.40
5.4.160.0050.03612.39
5.4.150.0060.03712.39
5.4.140.0030.04712.07
5.4.130.0070.04712.06
5.4.120.0080.03912.02
5.4.110.0080.03312.01
5.4.100.0070.03312.02
5.4.90.0050.03612.01
5.4.80.0090.03312.01
5.4.70.0040.03712.01
5.4.60.0070.03312.01
5.4.50.0040.03712.01
5.4.40.0080.03212.00
5.4.30.0050.03511.99
5.4.20.0070.03312.00
5.4.10.0040.03512.00
5.4.00.0040.03711.48
5.3.290.0060.03812.80
5.3.280.0060.03712.71
5.3.270.0060.03912.73
5.3.260.0060.03912.72
5.3.250.0050.03912.72
5.3.240.0080.03612.72
5.3.230.0070.03712.71
5.3.220.0060.03912.68
5.3.210.0080.03812.68
5.3.200.0050.03712.68
5.3.190.0040.04112.68
5.3.180.0060.03812.68
5.3.170.0090.04112.66
5.3.160.0060.03712.68
5.3.150.0070.03712.68
5.3.140.0110.04612.66
5.3.130.0080.04012.66
5.3.120.0070.03612.66
5.3.110.0070.03612.66
5.3.100.0120.03412.13
5.3.90.0090.03612.10
5.3.80.0030.03912.09
5.3.70.0060.03612.09
5.3.60.0040.03812.07
5.3.50.0070.03512.03
5.3.40.0060.03612.03
5.3.30.0070.03411.98
5.3.20.0080.03311.77
5.3.10.0050.03911.73
5.3.00.0060.03911.71
5.2.170.0040.0319.22
5.2.160.0050.0289.22
5.2.150.0050.0309.22
5.2.140.0070.0279.22
5.2.130.0050.0289.18
5.2.120.0040.0289.18
5.2.110.0070.0339.18
5.2.100.0040.0299.18
5.2.90.0040.0299.18
5.2.80.0050.0309.17
5.2.70.0060.0289.17
5.2.60.0070.0279.13
5.2.50.0070.0329.10
5.2.40.0040.0369.07
5.2.30.0050.0389.05
5.2.20.0030.0329.04
5.2.10.0060.0258.94
5.2.00.0070.0258.81
5.1.60.0040.0248.09
5.1.50.0050.0308.09
5.1.40.0080.0248.07
5.1.30.0070.0268.42
5.1.20.0020.0288.44
5.1.10.0030.0278.17
5.1.00.0050.0258.17
5.0.50.0030.0206.64
5.0.40.0030.0196.50
5.0.30.0030.0316.32
5.0.20.0040.0196.28
5.0.10.0050.0186.26
5.0.00.0030.0346.25
4.4.90.0030.0154.78
4.4.80.0040.0144.76
4.4.70.0000.0184.75
4.4.60.0020.0164.75
4.4.50.0040.0144.77
4.4.40.0030.0244.70
4.4.30.0020.0234.76
4.4.20.0030.0164.85
4.4.10.0030.0154.85
4.4.00.0050.0304.75
4.3.110.0030.0164.67
4.3.100.0020.0164.66
4.3.90.0020.0234.64
4.3.80.0030.0294.58
4.3.70.0020.0154.63
4.3.60.0010.0234.63
4.3.50.0050.0184.63
4.3.40.0040.0264.54
4.3.30.0020.0163.30
4.3.20.0010.0173.29
4.3.10.0010.0193.24
4.3.00.0070.0237.50

preferences:
71.09 ms | 401 KiB | 5 Q