Quick question about array usage


First off, I’m having trouble traversing with nested arrays. Is it a good practice to keep your arrays sorted with keys but at the expense of making them deeper and deeper?

Does the all array functions listed on php.net traverse down the level? http://php.net/manual/en/function.array-keys.php

For example, what would be the output for array_keys of the array below? Would array_walk walk into the 2nd level
and reach key1, key2 etc?

$arr = array('level1a' =>
           array('level2a' => 
             array('key1' => '100', 'key2' => '200'),
         'level1b' =>
           array('level2b' =>
             array('key3' => '300', 'key4' => '400')


Hi aquilax thanks.

Hmm…after some thoughts I think its quite unlikely for the array functions to go deeper than the 1st level.

As for best practice for using arrays… hmm…its all about personal preference? Anyone wanna comment on this?

Check array_walk_recursive.