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 removeEmptyParameter($parameter) { $newArray = array(); if(is_array($parameter)) { foreach($parameter as $key => $value) { if(is_array($value)) { $value = removeEmptyParameter($value); } if(!empty($value) || $value ==="0") { $newArray[$key] = $value; } } return $newArray; } else { if(!empty($parameter) || $parameter ==="0") { return $parameter; } } } function isMultiDimensional($array) { if(is_array($array)) { foreach ($array as $key=>$value){ if(is_array($value)){ return true; } } } return false; } $string = 'rest_call=create_acct_complete_m&acct[acct_row][country]=US'; $cat = 'admintools-api'; parse_str($string, $output); $method = $output['rest_call']; $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' || $method=='create_acct_complete_m') { if(isMultiDimensional($c) || (array_keys($c)[0] != $row.'s' ) ){ $c = removeEmptyParameter($c); $options[$key][$k][$row][$r]=$c; } else { $options[$key][$k][$row][$r]=array_values($c)[0]; } } else { $options[$row][$r]=$c; } } } else { if($cat=='core-api') { ($key == $row) ? ($options[$key][$k] = $column) : ($options[$key][$k][$row] = $column); } else { $column=removeEmptyParameter($column); $options[$row][$k] = $column; } } } } } $apiLiveOptions[$key] = $apiLiveArray; } } else { $options[$key] = $value; $apiLiveOptions[$key] = $value; } }; var_dump($options);

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.00918.68
8.3.50.0120.00621.16
8.3.40.0160.00619.02
8.3.30.0150.00418.85
8.3.20.0070.00020.09
8.3.10.0050.00321.60
8.3.00.0080.00023.67
8.2.180.0100.00716.63
8.2.170.0120.00922.96
8.2.160.0100.00720.34
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0080.00019.79
8.2.120.0040.00426.35
8.2.110.0000.01022.09
8.2.100.0070.00718.03
8.2.90.0040.00419.30
8.2.80.0040.00418.05
8.2.70.0060.00317.63
8.2.60.0000.00818.05
8.2.50.0040.00418.07
8.2.40.0040.00420.59
8.2.30.0040.00419.59
8.2.20.0000.00817.77
8.2.10.0030.00618.02
8.2.00.0030.00518.15
8.1.280.0070.00725.92
8.1.270.0080.00020.31
8.1.260.0000.00828.09
8.1.250.0000.00828.09
8.1.240.0090.00023.93
8.1.230.0090.00318.98
8.1.220.0030.00617.79
8.1.210.0030.00818.77
8.1.200.0060.00317.35
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0050.00318.69
8.1.160.0040.00420.73
8.1.150.0000.00718.96
8.1.140.0080.00019.63
8.1.130.0030.00317.84
8.1.120.0070.00017.52
8.1.110.0070.00017.50
8.1.100.0040.00417.55
8.1.90.0050.00317.39
8.1.80.0030.00517.48
8.1.70.0030.00317.46
8.1.60.0030.00617.47
8.1.50.0030.00617.55
8.1.40.0030.00517.55
8.1.30.0030.00517.51
8.1.20.0000.00717.65
8.1.10.0040.00417.59
8.1.00.0080.00017.54
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0070.00018.42
8.0.270.0040.00417.19
8.0.260.0000.00817.28
8.0.250.0000.00716.98
8.0.240.0000.00616.87
8.0.230.0040.00416.97
8.0.220.0050.00216.85
8.0.210.0000.00816.93
8.0.200.0070.00017.04
8.0.190.0060.00316.97
8.0.180.0000.00716.90
8.0.170.0040.00416.92
8.0.160.0000.00716.80
8.0.150.0050.00216.75
8.0.140.0000.00716.86
8.0.130.0060.00013.33
8.0.120.0040.00416.90
8.0.110.0000.00716.76
8.0.100.0000.00716.87
8.0.90.0040.00416.96
8.0.80.0100.00716.98
8.0.70.0030.00516.90
8.0.60.0000.00716.77
8.0.50.0000.00816.70
8.0.30.0130.00717.19
8.0.20.0110.01117.40
8.0.10.0000.00816.91
8.0.00.0130.00816.70
7.4.330.0000.00516.73
7.4.320.0040.00416.52
7.4.300.0080.00016.63
7.4.290.0050.00216.65
7.4.280.0080.00016.47
7.4.270.0000.00716.54
7.4.260.0060.00316.66
7.4.250.0050.00316.64
7.4.240.0060.00216.58
7.4.230.0030.00316.52
7.4.220.0110.01116.64
7.4.210.0090.00816.67
7.4.200.0050.00216.65
7.4.160.0120.00616.67
7.4.150.0140.00317.40
7.4.140.0170.01017.86
7.4.130.0130.00816.47
7.4.120.0050.01216.59
7.4.110.0120.00616.52
7.4.100.0190.00616.45
7.4.90.0070.01116.63
7.4.80.0180.00419.39
7.4.70.0100.01416.36
7.4.60.0100.00716.68
7.4.50.0080.00816.54
7.4.40.0080.01016.60
7.4.30.0070.01016.53
7.4.00.0050.00515.04
7.3.330.0000.00513.43
7.3.320.0050.00013.45
7.3.310.0000.00716.30
7.3.300.0070.00016.43
7.3.290.0070.00016.36
7.3.280.0080.00716.38
7.3.270.0030.01617.40
7.3.260.0130.00316.59
7.3.250.0130.00616.56
7.3.240.0150.00416.45
7.3.230.0130.00716.51
7.3.210.0090.00916.39
7.3.200.0090.00916.62
7.3.190.0150.00316.53
7.3.180.0150.00916.24
7.3.170.0170.00016.54
7.3.160.0130.01016.34
7.2.330.0150.00716.80
7.2.320.0150.00816.54
7.2.310.0070.01016.81
7.2.300.0040.01516.89
7.2.290.0130.00616.84
7.2.00.0030.00619.36
7.1.100.0080.00618.25
7.1.70.0000.00717.25
7.1.60.0060.01319.27
7.1.50.0060.01816.79
7.1.00.0100.06722.40
7.0.200.0030.00616.76
7.0.60.0170.06321.88
7.0.50.0130.06717.92
7.0.40.0000.08720.20
7.0.30.0470.05320.23
7.0.20.0470.08020.10
7.0.10.0030.04720.17
7.0.00.0130.08320.16
5.6.280.0030.03720.91
5.6.210.0170.07020.71
5.6.200.0070.05018.26
5.6.190.0200.07320.79
5.6.180.0330.04020.47
5.6.170.0230.05320.47
5.6.160.0030.07020.39
5.6.150.0030.05318.25
5.6.140.0100.03318.24
5.6.130.0000.07018.18
5.6.120.0170.05321.14
5.6.110.0070.09021.10
5.6.100.0030.09021.16
5.6.90.0130.06721.05
5.6.80.0070.08320.31
5.5.350.0100.07720.43
5.5.340.0070.08017.93
5.5.330.0130.07020.37
5.5.320.0500.04720.25
5.5.310.0300.06020.41
5.5.300.0070.06017.98
5.5.290.0030.06318.01
5.5.280.0070.08720.75
5.5.270.0100.08020.84
5.5.260.0100.06320.98
5.5.250.0100.07720.80
5.5.240.0130.05320.06

preferences:
37.75 ms | 401 KiB | 5 Q