Ok so I understand what a class is I think but I don't understand how to extract data from the variables created. Suppose I have this class that creates an object:
stdClass Object
(
[documentID] =>
[estimatedTotalResultsCount] => 270
[searchTime] => 0.029824
[resultElements] => Array
(
[0] => stdClass Object
(
[productID] => 12
[productName] => Widget (Blue)
[productPrice]=> 12.95
)
[1] => stdClass Object
(
[productID] => 3
[productName] => Widget (Orange)
[productPrice]=> 39.72
)
)
[searchQuery] => whatever
)
Ok so I have these objects created, and I know that if I do this code:
echo $result->searchQuery . "<br>";
will print "whatever". But how do you go to the deeper variables, past the products? Like to say:
echo $result->resultElements[0]->productName . "<br>"
prints nothing, and
echo $result->resultElements[0] . "<br>"
prints "Object".
Sorry, I know this is a basic question. Thanks in advance.
... Christopher