Created
September 8, 2014 13:28
-
-
Save willboudle/a7d205a5215cca6d19e3 to your computer and use it in GitHub Desktop.
Iterating over a complex Associative Array in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //use: | |
| iterator($n); | |
| function iterator($arr){ | |
| foreach($arr as $key => $val){ | |
| if(is_array($val))iterator($val); | |
| echo '<p>key: '.$key.' | value: '.$val.'</p>'; | |
| //filter the $key and $val here and do what you want | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment