I tried to find an answer in the original docs of php.net, but I can't found a valid explanation to me. Could you help me in understanding why the node with value 4 disappears in the following code? Thanks in advance,
$ARRAY = [
"1" =>
[
1, 2, 3
],
4,
"2" => [
"2.1" => [ 5, 6, 7 ]
]
];
echo "ARRAY : <pre>".print_r( $ARRAY, 1 )."</pre><br/>";
4is at index location1and you already have that key with an array as value. Hence, this behavior. That being said, numeric keys aren't a good idea for associative arrays due to such issues.4gets overwritten by2key.