How would I call this element via SimpleXML?
$xml->ls:viewMinutesThisWeek
definitely wouldn't work
<ls:viewerMinutesThisWeek>5700</ls:viewerMinutesThisWeek>
How would I call this element via SimpleXML?
$xml->ls:viewMinutesThisWeek
definitely wouldn't work
<ls:viewerMinutesThisWeek>5700</ls:viewerMinutesThisWeek>
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;