Thanks Jason,

I though that might be the case. I usually do try to use arrays as much as
I can. This has just reminded me why. I ended up casting the object as an
array and going from there.

regards
Aaron

> Here's a link for you.
>
> http://www.php.net/manual/en/language.variables.basics.php
>
> Those variable names look invalid.
>
> If you insist numeric variable name, why don't you add underscore?
>
>> $myobject->_100->property1;
>> $myobject->_100->property2;
>>
>> $myobject->_101->property1;
>> $myobject->_101->property2;
>
> If you need integer indexing for accessing your data structure, you'd
> better change it to just indexed array.
>
> Thanks,
>
> Jason.
>
> On Fri, Nov 18, 2011 at 10:25 AM, Aaron Fulton <[email protected]>
> wrote:
>> Hi,
>> This should be an easy one but the answer is alluding me this morning.
>>  I
>> have a data structure:
>>
>> $myobject->100->property1;
>> $myobject->100->property2;
>>
>> $myobject->101->property1;
>> $myobject->101->property2;
>>
>> I'm attempting to set a property like this however it does not work. I
>> suspect it's because my ID is numeric. Am I able to do this and if not
>> want is the best workaround?
>>
>> foreach ($myobject as $id > info) {
>>  $myobject->{$id}->property3  1;
>> }
>>
>> regards
>> Aaron
>>
>> --
>> NZ PHP Users Group: http://groups.google.com/group/nzphpug
>> To post, send email to [email protected]
>> To unsubscribe, send email to
>> [email protected]
>
> --
> NZ PHP Users Group: http://groups.google.com/group/nzphpug
> To post, send email to [email protected]
> To unsubscribe, send email to
> [email protected]
>


-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to