3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isEmptyArray($item) { if (is_array($item)) { return array_filter($item, 'isEmptyArray'); } if (!empty($item) || $item === "0") { return true; } return false; } function removeEmptyArrays($array) { $filteredArray = array_filter($array, 'isEmptyArray'); return $filteredArray; } function isMultiDimensional($array) { if(is_array($array)) { foreach ($array as $key=>$value){ if(is_array($value)){ return true; } } } return false; } $str='discount_rule[0][service_no][0][service_nos]=100';//'service[0][tier][0][schedule][0][amount]=10'; parse_str($str, $output); $cat='admintools-api'; $options = array(); $apiLiveOptions = array(); foreach ($output AS $key => $value) { if (is_array($value)) { if (!empty($value[$key])) { $options[$key] = $value; $apiLiveOptions[$key] = $value; } else { $array = array(); $apiLiveArray = array(); foreach ($value as $k => $v) { if(!empty($v[$k])) { $array[] = $value[$k]; $apiLiveArray[] = $value[$k]; $options[$key] = $array; } else { $newArray = array_filter($v, 'isEmptyArray'); $apiLiveArray[$k] = $newArray; foreach($newArray as $row => $column) { if(is_array($column)) { foreach($column as $r=>$c) { if($cat=='admintools-api') { var_dump($c); var_dump(count(array_values($c)[0])); //$options[$key][$k][$row][$r]=array_values($c)[0]; } else { $options[$row][$r]=$c; } } } else { if($cat=='admintools-api') { $key == $row ? $options[$key][$k] = $column : $options[$key][$k][$row] = $column; } else { $array[$k]=$column; $options[$row] = $array; } } } } } $apiLiveOptions[$key] = $apiLiveArray; } } else { $options[$key] = $value; $apiLiveOptions[$key] = $value; } }; //var_dump($apiLiveOptions); ?>

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.00616.61
8.3.50.0110.00418.07
8.3.40.0130.00318.74
8.3.30.0120.00318.80
8.3.20.0040.00420.46
8.3.10.0030.00523.62
8.3.00.0080.00019.97
8.2.180.0150.00416.63
8.2.170.0140.00722.96
8.2.160.0100.01020.24
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0060.00319.38
8.2.120.0050.00326.35
8.2.110.0060.00320.54
8.2.100.0040.00818.05
8.2.90.0050.00319.20
8.2.80.0000.00817.97
8.2.70.0050.00317.63
8.2.60.0040.00418.03
8.2.50.0030.00518.07
8.2.40.0030.00522.30
8.2.30.0040.00420.71
8.2.20.0030.00617.84
8.2.10.0000.00718.03
8.2.00.0040.00418.01
8.1.280.0150.00625.92
8.1.270.0100.01020.21
8.1.260.0040.00428.09
8.1.250.0090.00028.09
8.1.240.0040.00422.11
8.1.230.0040.00817.55
8.1.220.0000.00817.74
8.1.210.0090.00018.77
8.1.200.0030.00617.35
8.1.190.0040.00417.25
8.1.180.0040.00418.10
8.1.170.0000.00918.66
8.1.160.0000.00720.77
8.1.150.0030.00518.89
8.1.140.0040.00419.47
8.1.130.0000.00817.66
8.1.120.0030.00517.35
8.1.110.0000.00717.34
8.1.100.0040.00417.53
8.1.90.0070.00017.53
8.1.80.0000.00717.37
8.1.70.0070.00017.43
8.1.60.0040.00417.60
8.1.50.0000.00917.56
8.1.40.0030.00617.54
8.1.30.0110.00017.70
8.1.20.0030.00617.71
8.1.10.0000.00817.46
8.1.00.0040.00417.39
8.0.300.0050.00218.77
8.0.290.0000.00716.75
8.0.280.0000.00718.46
8.0.270.0040.00417.20
8.0.260.0000.00617.27
8.0.250.0030.00316.97
8.0.240.0040.00417.04
8.0.230.0020.00517.04
8.0.220.0030.00317.01
8.0.210.0000.00816.96
8.0.200.0050.00217.05
8.0.190.0050.00316.99
8.0.180.0040.00417.00
8.0.170.0040.00416.95
8.0.160.0000.00816.95
8.0.150.0080.00317.00
8.0.140.0040.00416.89
8.0.130.0000.00613.45
8.0.120.0040.00416.93
8.0.110.0000.00716.87
8.0.100.0030.00516.87
8.0.90.0050.00216.80
8.0.80.0030.01916.91
8.0.70.0040.00416.80
8.0.60.0040.00417.04
8.0.50.0030.00516.92
8.0.30.0130.00917.29
8.0.20.0120.00617.40
8.0.10.0050.00217.05
8.0.00.0100.01016.78
7.4.330.0050.00016.71
7.4.320.0030.00316.54
7.4.300.0060.00016.54
7.4.290.0000.00716.50
7.4.280.0090.00016.49
7.4.270.0100.00016.53
7.4.260.0070.00416.52
7.4.250.0000.00716.50
7.4.240.0020.00516.47
7.4.230.0030.00316.61
7.4.220.0120.00616.64
7.4.210.0040.01116.64
7.4.200.0030.00316.50
7.4.160.0070.01016.38
7.4.150.0050.01517.40
7.4.140.0160.00617.86
7.4.130.0110.00716.53
7.4.120.0130.00516.67
7.4.110.0040.01416.58
7.4.100.0130.00916.48
7.4.90.0110.00616.69
7.4.80.0140.00319.39
7.4.70.0070.01016.54
7.4.60.0090.00816.56
7.4.50.0000.01516.45
7.4.40.0110.00816.62
7.4.30.0100.00716.73
7.4.00.0030.01314.85
7.3.330.0050.00013.26
7.3.320.0030.00313.45
7.3.310.0000.00716.47
7.3.300.0000.00716.43
7.3.290.0000.00716.45
7.3.280.0070.01016.42
7.3.270.0130.00317.40
7.3.260.0130.00616.50
7.3.250.0060.01216.50
7.3.240.0100.00916.38
7.3.230.0150.00616.52
7.3.210.0120.00616.58
7.3.200.0080.00816.54
7.3.190.0100.00516.43
7.3.180.0160.00016.73
7.3.170.0060.00916.40
7.3.160.0160.00016.47
7.3.10.0040.00516.67
7.3.00.0000.00916.56
7.2.330.0150.00316.47
7.2.320.0140.00516.80
7.2.310.0060.01016.80
7.2.300.0030.01416.75
7.2.290.0130.00716.79
7.2.130.0000.01317.14
7.2.120.0080.00416.97
7.2.110.0090.00616.77
7.2.100.0030.00616.73
7.2.90.0040.00717.01
7.2.80.0080.00516.93
7.2.70.0170.00017.13
7.2.60.0050.00616.84
7.2.50.0060.00617.06
7.2.40.0030.00916.87
7.2.30.0060.00616.95
7.2.20.0060.00917.11
7.2.10.0060.00916.97
7.2.00.0060.00818.19
7.1.250.0070.00715.54
7.1.200.0030.00615.97
7.1.100.0030.01017.87
7.1.70.0000.00716.92
7.1.60.0100.01319.13
7.1.50.0070.01516.91
7.1.00.0030.07722.45
7.0.200.0030.00616.53
7.0.60.0070.08719.95
7.0.50.0030.07717.96
7.0.40.0070.04020.40
7.0.30.0330.05720.09
7.0.20.0300.04320.30
7.0.10.0130.03720.06
7.0.00.0070.05720.08
5.6.280.0030.06721.11
5.6.210.0100.05020.62
5.6.200.0030.04318.21
5.6.190.0000.06020.65
5.6.180.0170.05020.67
5.6.170.0200.04020.71
5.6.160.0130.06020.50
5.6.150.0130.07018.16
5.6.140.0030.04018.24
5.6.130.0030.07018.23
5.6.120.0070.08021.00
5.6.110.0100.03721.13
5.6.100.0130.04020.98
5.6.90.0100.04721.11
5.6.80.0030.08020.52
5.5.350.0170.03720.54
5.5.340.0100.07018.02
5.5.330.0170.04320.44
5.5.320.0270.03720.27
5.5.310.0200.06320.30
5.5.300.0100.04717.96
5.5.290.0070.06017.99
5.5.280.0000.04320.75
5.5.270.0100.07720.88
5.5.260.0100.07320.85
5.5.250.0100.09020.60
5.5.240.0100.06320.12

preferences:
50.17 ms | 400 KiB | 5 Q