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]
|