I have an XML file after doing VAR_DUMP() this is what it returns
["EditorialReviews"]=>
object(stdClass)#120 (1) {
["EditorialReview"]=>
array(2) {
[0]=>
object(stdClass)#121 (3) {
["Source"]=>
string(19) "Product Description"
["Content"]=>
string(610) "Description."
["IsLinkSuppressed"]=>
bool(false)
}
[1]=>
object(stdClass)#118 (3) {
["Source"]=>
string(30) "Product Description"
["Content"]=> "Description 2"
}
}
I’ve never had this, this XML file has an array inside of it, how do I get only the first one? Usually I would just do
$this->EditorialReviews->EditorialReview->Content
But that returns NULL or it doesn’t show up when there’s an array in there.
and
$this->EditorialReviews->EditorialReview->Content[0]
Gives me an error
Also, I tried using php’s simpleXML but it gave me an error too..
Try this: