@ 2018-07-16T00:58:50Z <?php
function _flatten_array($arr) {
while ($arr) {
list($key, $value) = each($arr);
is_array($value) ? $arr = $value : $out[$key] = $value;
unset($arr[$key]);
}
return (array)$out;
}
$aNonFlat = array(
1,
2,
array(
3,
4,
5,
array(
6,
7
),
8,
9,
),
10,
11
);
var_export(_flatten_array($aNonFlat));
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 , 8.3.0 - 8.3.26 , 8.4.1 - 8.4.13 Fatal error: Uncaught Error: Call to undefined function each() in /in/7cO9N:4
Stack trace:
#0 /in/7cO9N(28): _flatten_array(Array)
#1 {main}
thrown in /in/7cO9N on line 4
Process exited with code 255 . Output for 7.2.0 - 7.2.33 , 7.3.0 - 7.3.31 , 7.4.0 - 7.4.33 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/7cO9N on line 4
array (
0 => 6,
1 => 7,
) Output for 7.1.0 - 7.1.33 , 7.3.32 - 7.3.33 array (
0 => 6,
1 => 7,
) preferences:dark mode live preview ace vim emacs key bindings
91.03 ms | 408 KiB | 5 Q