php - Can't access stdObject array using [] or -> operators -


this question has answer here:

i have stdobject , var_dump result below:

var_dump($name) array(1) {   [0]=>   object(stdclass)#853 (2) {     ["firstname"]=>     string(2) "john"     ["lastname"]=>     string(8) "smith"   } } 

i trying make new variable $fullname using $name['firstname].$name['lastname']. doesn't work, gives error undefined index

then tried using -> operator on $name->firstname + $name->lastname. gives error: trying property of non-object

how go this?

$name[0]->firstname . $name[0]->lastname;

basically trying access array object. can see var_dump variable contains array. array contains object 2 properties. $name[0] gives object, , ->firstname accesses firstname property of object.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -