Read Element Attributes with PHP SimpleXML

<?php 

$s = '<?xml version="1.0" encoding="UTF-8"?>
<product id="p02">
	<name>Name 2</name>
	<price currency="USD">200</price>
</product>
';

$product = simplexml_load_string($s);

echo 'id: ' .$product['id'];
echo '<br>currency: ' .$product->price['currency'];

?>
id: p02
currency: USD