porto alet
porto alet

Reputation: 1925

Accessing SimpleXML Object attribute

Have this print output from print_r($theobject);

SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [label] => a
        )

    [0] => Abnormal psychology : Abnormal psychology :
)

Just cannot find a way to get element 0 which is "Abnormal psychology :"

Lets call the object as $theobject I did $theobject[0], didn't get anything.

Many Thanks

Upvotes: 3

Views: 1525

Answers (1)

Greg
Greg

Reputation: 321638

You can just cast the object to a string:

$str = (string)$theobject;

Upvotes: 4

Related Questions