I have an stdObject
and its var_dump
result is below:
var_dump($name)
array(1) {
[0]=>
object(stdClass)#853 (2) {
["firstname"]=>
string(2) "John"
["lastname"]=>
string(8) "Smith"
}
}
I am trying to make a new variable $fullname
by using $name['firstname].$name['lastname']
. It doesn't work, gives the error Undefined index
Then I tried using the ->
operator on $name->firstname + $name->lastname
. Gives the error: trying to get property of non-object
How do I go about this?