How does php traverse a complex multi-dimensional array, such as an array without any regularity? How does php traverse it? PHPcode $ arrarray (array (val1, val2, val3), aa, bb), php, apache, array (hello, world )); ------ solution ----------------- how php traverses a complex multi-dimensional array
For example, how can we traverse an array without any regularity?
PHP code
$ Arr = array ('val1', 'val2', 'val3'), 'AA', 'BB'), 'php', 'Apache ', array ('hello', 'World '));
------ Solution --------------------
What do you want to do after traversing? Recursive processing is supported.
PHP code
// As the callback function. The parameter will not be an array function doSomething ($ value) {echo $ value;} function look (array $ array) {foreach ($ array as $ value) {// if it is still an array, then continue traversing if (is_array ($ value) look ($ value); else call_user_func ('dosomething ', $ value );}}