php - Accessing object property with variable -


i have object full of arrays, able change element in array code

$i = 0; $object->property[$i] = "some value"; 

however following code not change value , returns no errors.

 $i = 0;  $propertyname = "property";  $object->$propertyname[$i] = "some value"; 

try:

 $i = 0;  $propertyname = "property";  $object->{$propertyname}[$i] = "some value"; 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -