With the index, you can pluck a value out of an array, like this:
$food = array(0 => 'banana', 1 => 'taco', 2 => 'toast');
foreach($menus as $menu) {
echo 'Today will will be eating ' . $food[$menu['food_id']];
}
But if my food array looks like this…
$food[] = array('id' => 1, 'name' => 'banana');
$food[] = array('id' => 2, 'name' => 'taco');
$food[] = array('id' => 3, 'name' => 'toast');
…it's not possible unless you do this first…
foreach($food as $item) {
$food_notmulti[$item['id']] = $item['name'];
}
…to flatten it.
Or am I wrong? Is there a way to "pluck" from the multi-dimensional
array where the ID is not an index?
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
