Skip to content

Instantly share code, notes, and snippets.

@EdwardIII
Last active December 20, 2015 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdwardIII/6122416 to your computer and use it in GitHub Desktop.
Save EdwardIII/6122416 to your computer and use it in GitHub Desktop.
<?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