Skip to content

Instantly share code, notes, and snippets.

@willboudle
Created September 8, 2014 13:28
Show Gist options
  • Select an option

  • Save willboudle/a7d205a5215cca6d19e3 to your computer and use it in GitHub Desktop.

Select an option

Save willboudle/a7d205a5215cca6d19e3 to your computer and use it in GitHub Desktop.
Iterating over a complex Associative Array in PHP
//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