Reply to Re: referencing an array element with a string variable

Your name:

Reply:


Posted by Shelly on 07/19/05 07:00

"Bosconian" <bosconian@planetx.com> wrote in message
news:97GdnQ-W6r5A7kHfRVn-tA@comcast.com...
> I've been researching this for hours and can't seem to find the right
> syntax.
>
> I need to retrieve a value of an array by referencing the element using a
> string variable.
>
> For example:
>
> $data['lastname'] = 'hank';
> $element = 'lastname';
> echo $data[$element];
>
> Outputs:
>
> hank
>
> Seems straightforward enough, but the solution escapes me.
>
> Someone clue me in--thanks!

echo $data["$element"];

Shelly

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация