Last active
December 20, 2015 11:19
-
-
Save EdwardIII/6122416 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
$taxonomies = array( | |
array( | |
'name' => 'people', | |
'members' => array( | |
array('name' => 'Bill Clinton', 'cheater' => true), | |
array('name' => 'Barrack Obama', 'cheater' => false), | |
array('name' => 'John F Kennedy', 'cheater' => true), | |
), | |
), | |
array( | |
'name' => 'animals', | |
'members' => array( | |
array('name' => 'Swan', 'cheater' => false), | |
array('name' => 'Hyena', 'cheater' => true), | |
), | |
), | |
); | |
foreach($taxonomies as &$taxonomy){ | |
foreach($taxonomy['members'] as &$member){ | |
$member['message'] = 'Relax, nothing to worry about'; | |
if($member['cheater']){ | |
$member['message'] = "Better keep your eye on this one\n"; | |
} | |
unset($member); | |
} | |
unset($taxonomy); | |
} | |
// Later... | |
foreach($taxonomies as $taxonomy){ | |
print strtoupper($taxonomy['name']) . "\n"; | |
foreach($taxonomy['members'] as $member){ | |
print "\t" . $member['name'] . "\n"; | |
print "\t" . $member['message'] . "\n\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment