3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'a', 'b', 'c' => array(1,2) ); $formt = array( 'A' => array( 'is_need' => true, 'type_condition' => 'or', 'type' => false, ), 'B', 'C' => array( 'child' => array( 'C1' => array( 'is_need' => true, 'type_condition' => 'or', 'type' => false, ), 'C2' => array( 'is_need' => true, 'type_condition' => 'or', 'type' => false, ), ) ), ); function formatParams($arr, $formt) { list($f_k, $f_v) = each($formt); $data = array(); foreach($arr as $key => $val) { if(is_array($val)) { $data[$f_k] = formatParams($val, $f_v['child']); } else { if(is_array($f_v)) { $data[$f_k] = $val; } else { $data[$f_v] = $val; } } list($f_k, $f_v) = each($formt); } return $data; } // var_dump(formatParams($arr, $formt)); list($key, $val) = each($arr); for($i = 0; $i <= 4;++$i) { echo $key . "\n"; echo (list($key, $val) = each($arr)) . "\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.0120.00916.75
8.3.50.0060.01121.14
8.3.40.0160.00318.98
8.3.30.0140.00318.79
8.3.20.0000.00820.32
8.3.10.0080.00023.71
8.3.00.0050.00319.97
8.2.180.0120.00316.47
8.2.170.0100.00322.96
8.2.160.0110.00720.52
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0000.00820.94
8.2.120.0130.00326.35
8.2.110.0060.00320.20
8.2.100.0030.00817.91
8.2.90.0080.00019.05
8.2.80.0040.00417.97
8.2.70.0110.00017.63
8.2.60.0080.00417.93
8.2.50.0040.00418.07
8.2.40.0030.00622.21
8.2.30.0070.00020.59
8.2.20.0040.00417.66
8.2.10.0000.01018.10
8.2.00.0040.00418.08
8.1.280.0120.00325.92
8.1.270.0090.00020.38
8.1.260.0050.00328.09
8.1.250.0040.00428.09
8.1.240.0070.00423.92
8.1.230.0040.00720.97
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0060.00317.22
8.1.190.0040.00417.35
8.1.180.0030.00618.10
8.1.170.0050.00318.51
8.1.160.0000.00720.73
8.1.150.0000.00718.93
8.1.140.0030.00519.46
8.1.130.0070.00017.68
8.1.120.0020.00517.31
8.1.110.0030.00517.40
8.1.100.0040.00417.45
8.1.90.0000.00717.46
8.1.80.0000.00717.47
8.1.70.0000.00717.40
8.1.60.0000.00817.54
8.1.50.0080.00017.54
8.1.40.0000.00817.58
8.1.30.0030.00517.71
8.1.20.0000.00817.65
8.1.10.0000.00817.66
8.1.00.0040.00417.52
8.0.300.0090.00018.77
8.0.290.0030.00616.75
8.0.280.0000.00718.42
8.0.270.0050.00317.19
8.0.260.0030.00317.36
8.0.250.0000.00716.96
8.0.240.0030.00316.92
8.0.230.0040.00417.03
8.0.220.0000.00716.83
8.0.210.0000.00816.80
8.0.200.0000.00616.85
8.0.190.0000.00816.90
8.0.180.0080.00016.84
8.0.170.0040.00416.95
8.0.160.0040.00416.88
8.0.150.0030.00616.82
8.0.140.0080.00016.91
8.0.130.0050.00013.26
8.0.120.0000.00816.79
8.0.110.0070.00016.80
8.0.100.0040.00416.71
8.0.90.0050.00216.81
8.0.80.0090.00616.93
8.0.70.0000.00716.90
8.0.60.0000.00816.88
8.0.50.0040.00416.87
8.0.30.0100.00817.06
8.0.20.0100.01017.40
8.0.10.0050.00316.93
8.0.00.0110.00716.75
7.4.330.0000.00516.66
7.4.320.0070.00016.49
7.4.300.0070.00016.58
7.4.290.0070.00016.38
7.4.280.0030.00516.43
7.4.270.0030.00316.58
7.4.260.0030.00316.36
7.4.250.0040.00416.43
7.4.240.0040.00416.48
7.4.230.0000.00716.59
7.4.220.0090.01216.46
7.4.210.0140.00416.52
7.4.200.0070.00016.57
7.4.160.0040.01216.63
7.4.150.0170.00017.40
7.4.140.0100.01017.86
7.4.130.0100.01016.61
7.4.120.0100.01116.56
7.4.110.0070.01116.48
7.4.100.0070.01116.76
7.4.90.0120.00416.64
7.4.80.0130.01619.39
7.4.70.0080.00816.70
7.4.60.0160.00316.60
7.4.50.0030.00916.66
7.4.40.0070.01016.51
7.4.30.0090.00916.67
7.4.00.0080.00814.98
7.3.330.0000.00513.43
7.3.320.0000.00513.29
7.3.310.0050.00316.32
7.3.300.0030.00316.50
7.3.290.0030.00316.41
7.3.280.0080.01016.42
7.3.270.0080.00817.40
7.3.260.0100.00716.59
7.3.250.0070.01316.53
7.3.240.0100.01016.46
7.3.230.0100.00716.52
7.3.210.0160.00716.55
7.3.200.0140.00916.41
7.3.190.0090.00716.43
7.3.180.0090.00916.57
7.3.170.0120.01016.44
7.3.160.0090.00916.45
7.2.330.0160.00316.64
7.2.320.0180.00016.69
7.2.310.0000.01716.71
7.2.300.0120.00616.59
7.2.290.0160.00616.76
7.2.60.0110.00416.70
7.2.00.0030.01019.22
7.1.200.0070.00415.73
7.1.100.0000.01117.86
7.1.70.0000.00817.21
7.1.60.0150.01119.52
7.1.50.0070.01616.70
7.1.00.0100.07022.46
7.0.200.0040.01516.86
7.0.60.0170.07319.93
7.0.50.0100.08017.89
7.0.40.0070.08720.21
7.0.30.0130.05020.26
7.0.20.0170.04320.30
7.0.10.0000.09320.16
7.0.00.0100.08020.32
5.6.280.0030.06721.14
5.6.210.0100.07720.65
5.6.200.0070.05018.29
5.6.190.0100.08020.61
5.6.180.0230.07320.42
5.6.170.0400.07320.44
5.6.160.0070.04720.55
5.6.150.0070.04318.18
5.6.140.0100.07718.28
5.6.130.0100.05018.29
5.6.120.0100.08321.03
5.6.110.0070.09021.02
5.6.100.0170.07321.00
5.6.90.0130.05020.89
5.6.80.0130.07320.50
5.5.350.0230.04720.51
5.5.340.0070.08318.05
5.5.330.0170.07320.32
5.5.320.0600.05320.31
5.5.310.0300.04320.30
5.5.300.0130.07717.97
5.5.290.0030.07317.97
5.5.280.0100.04320.89
5.5.270.0070.07020.85
5.5.260.0170.07320.70
5.5.250.0270.06020.80
5.5.240.2970.04320.13

preferences:
65.04 ms | 401 KiB | 5 Q