Will Manson
Will Manson

Reputation: 167

Accessing XML value with PHP

How would you access the value of 'seconds' within this XML code using PHP?

<entry><yt:duration seconds='339'/></entry>

So far I have:

$xml -> entry -> ?!?

For Serty:

<?xml version='1.0' encoding='UTF-8'?>

Upvotes: 0

Views: 105

Answers (1)

Jess
Jess

Reputation: 8700

Well, what you are looking for is called an attribute. If you are using php to parse your xml, then I would look at http://php.net/manual/en/domelement.getattribute.php, and find a comment that helps you.

Without knowing how you are parsing it though, I can't help much more

Upvotes: 2

Related Questions