[UPHPU] pluck out of array with index without rebuilding

Wade Preston Shearer wadeshearer.lists at me.com
Fri Jan 16 09:23:51 MST 2009


On 16 Jan 2009, at 9:19, Scott Hill wrote:

> With the second array:
>
> $food[] = array('id' => 1, 'name' => 'banana');
> $food[] = array('id' => 2, 'name' => 'taco');
> $food[] = array('id' => 3, 'name' => 'toast');
> Why can't you do something like ...
> echo 'Today we will be eating '.$food[food_id]['name'];

Because the index of banana is zero, not 1.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2431 bytes
Desc: not available
Url : http://uphpu.org/pipermail/uphpu/attachments/20090116/2a04509e/smime.bin


More information about the UPHPU mailing list