NYCPHP Meetup

NYPHP.org

[nycphp-talk] array in object

Elijah Insua tmpvar at gmail.com
Wed Jan 21 20:32:23 EST 2009


$key is not phone1 ?

On Wed, Jan 21, 2009 at 8:24 PM, Rick Retzko <rick at click-rick.net> wrote:

>  Hi Folks -
>
> This should be simple, but I haven't been able to debug it on my own, so
> I'm asking for help.
>
> I'm walking through a user's webform submission that I've put into an
> object and comparing each of that object's properties with the current
> properties ($cur) stored on mySQL database.
> The example below is input for a phone number (phone1).
>
> This example stores the 10-digit phone number into variable $c:
> $c=$cur->phone1['descr'];
>
> If I use $key to capture the property to be checked ('phone1'), the
> following stores null:
> $b=$cur->$key['descr'];
>
> Any help on understanding why $cur->$key['descr'] is not synonymous with
> $cur->phone1['descr'] when $key='phone1' would be a help!
>
> Best Regards -
>
> Rick
> ============
> rick at click-rick.net
> 201.755.4083
>
>
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/show_participation.php
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090121/0eb67458/attachment.html>


More information about the talk mailing list