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='service[0][tier][0][schedule][0][amount]=10';//'discount_rule[0][service_no][0][service_nos]=100'; 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.0100.00716.63
8.3.50.0140.00522.16
8.3.40.0100.00618.77
8.3.30.0110.00418.75
8.3.20.0000.00820.33
8.3.10.0050.00323.52
8.3.00.0080.00019.85
8.2.180.0120.00616.50
8.2.170.0170.00322.96
8.2.160.0060.00920.49
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0060.00319.38
8.2.120.0050.00326.35
8.2.110.0030.00720.34
8.2.100.0030.00917.93
8.2.90.0040.00419.29
8.2.80.0040.00417.97
8.2.70.0060.00317.50
8.2.60.0040.00418.03
8.2.50.0060.00318.07
8.2.40.0050.00322.25
8.2.30.0000.00720.52
8.2.20.0040.00417.77
8.2.10.0050.00218.12
8.2.00.0080.00018.02
8.1.280.0110.00425.92
8.1.270.0080.00020.14
8.1.260.0000.00728.09
8.1.250.0070.00328.09
8.1.240.0060.00322.10
8.1.230.0070.00719.20
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0060.00317.35
8.1.180.0030.00518.10
8.1.170.0060.00318.59
8.1.160.0080.00020.83
8.1.150.0080.00018.91
8.1.140.0040.00419.66
8.1.130.0000.00717.68
8.1.120.0030.00517.52
8.1.110.0040.00417.38
8.1.100.0070.00017.50
8.1.90.0070.00017.48
8.1.80.0030.00517.34
8.1.70.0000.00717.48
8.1.60.0000.00717.55
8.1.50.0040.00417.56
8.1.40.0040.00417.54
8.1.30.0040.00417.68
8.1.20.0050.00317.63
8.1.10.0000.00817.49
8.1.00.0030.00517.42
8.0.300.0000.00718.77
8.0.290.0040.00416.75
8.0.280.0070.00018.46
8.0.270.0070.00017.32
8.0.260.0060.00017.21
8.0.250.0040.00416.88
8.0.240.0000.00816.96
8.0.230.0000.00716.93
8.0.220.0000.00816.91
8.0.210.0070.00016.82
8.0.200.0000.00716.84
8.0.190.0040.00416.90
8.0.180.0070.00016.82
8.0.170.0050.00316.91
8.0.160.0040.00416.80
8.0.150.0030.00716.83
8.0.140.0000.00916.84
8.0.130.0030.00313.42
8.0.120.0040.00416.78
8.0.110.0040.00416.85
8.0.100.0000.00716.81
8.0.90.0050.00216.79
8.0.80.0040.01716.91
8.0.70.0080.00016.77
8.0.60.0040.00416.73
8.0.50.0030.00516.84
8.0.30.0140.00517.27
8.0.20.0060.01217.40
8.0.10.0050.00317.10
8.0.00.0080.00916.74
7.4.330.0000.00616.71
7.4.320.0000.00616.49
7.4.300.0030.00316.61
7.4.290.0000.00716.63
7.4.280.0060.00316.61
7.4.270.0000.00716.52
7.4.260.0000.00716.36
7.4.250.0050.00316.45
7.4.240.0050.00216.43
7.4.230.0030.00316.33
7.4.220.0130.01316.64
7.4.210.0070.00816.68
7.4.200.0050.00216.72
7.4.160.0100.00616.49
7.4.150.0170.00017.40
7.4.140.0120.00917.86
7.4.130.0110.00616.54
7.4.120.0100.00816.43
7.4.110.0140.00716.59
7.4.100.0180.00716.34
7.4.90.0070.01016.48
7.4.80.0150.00819.39
7.4.70.0130.00316.55
7.4.60.0060.01116.66
7.4.50.0040.01216.37
7.4.40.0100.00716.68
7.4.30.0150.00916.70
7.4.00.0110.00414.87
7.3.330.0000.00513.39
7.3.320.0050.00013.16
7.3.310.0000.00716.26
7.3.300.0030.00316.23
7.3.290.0070.00016.38
7.3.280.0070.01116.38
7.3.270.0080.01117.40
7.3.260.0040.01316.60
7.3.250.0070.01216.50
7.3.240.0040.01316.48
7.3.230.0060.01616.51
7.3.210.0160.00016.60
7.3.200.0090.00616.58
7.3.190.0100.01316.48
7.3.180.0100.00616.30
7.3.170.0060.00916.43
7.3.160.0120.00416.55
7.2.330.0110.00816.78
7.2.320.0110.01116.73
7.2.310.0090.01016.55
7.2.300.0030.01416.69
7.2.290.0130.01016.51
7.2.00.0100.01019.20
7.1.100.0000.01118.02
7.1.70.0070.00016.93
7.1.60.0120.01219.13
7.1.50.0100.01417.01
7.1.00.0070.07322.48
7.0.200.0040.00416.68
7.0.60.0130.08019.86
7.0.50.0000.04317.93
7.0.40.0070.04019.96
7.0.30.0300.07720.09
7.0.20.0330.06320.19
7.0.10.0100.08320.16
7.0.00.0100.05020.05
5.6.280.0070.05720.88
5.6.210.0230.07320.66
5.6.200.0030.08018.18
5.6.190.0030.09020.68
5.6.180.0270.07020.64
5.6.170.0300.04720.40
5.6.160.0130.07720.55
5.6.150.0100.03718.19
5.6.140.0000.04318.17
5.6.130.0130.07718.15
5.6.120.0070.06721.13
5.6.110.0000.04721.04
5.6.100.0000.07721.06
5.6.90.0130.07720.98
5.6.80.0070.06720.42
5.5.350.0100.08020.48
5.5.340.0130.07017.99
5.5.330.0100.04320.21
5.5.320.0230.04720.42
5.5.310.0230.04020.34
5.5.300.0130.07317.97
5.5.290.0030.08317.94
5.5.280.0000.04320.70
5.5.270.0130.05320.66
5.5.260.0130.07720.74
5.5.250.0030.06720.48
5.5.240.0070.08720.27

preferences:
33.14 ms | 401 KiB | 5 Q