Ben
Ben

Reputation: 62384

How would I call this element via SimpleXML?

How would I call this element via SimpleXML?

$xml->ls:viewMinutesThisWeek definitely wouldn't work

   <ls:viewerMinutesThisWeek>5700</ls:viewerMinutesThisWeek>

Upvotes: 1

Views: 60

Answers (1)

BoltClock
BoltClock

Reputation: 723598

Since ls is a namespace, you need to filter elements that are of that namespace using the SimpleXMLElement::children() method. Try this:

$ls = $xml->children('ls', true);
echo $ls->viewerMinutesThisWeek;

Upvotes: 2

Related Questions