Recoger atributos con SimpleXML
Digamos que tengo el siguiente xml:
<libros> <libro> <autor edad="62">Stephen King<autor> </libro> </libros>
Para recoger el valor del atributo “edad” simplemente XD tenemos que hacer lo siguiente
$libros = simplexml_load_file('libros.xml');
$edad = $libros->libro->autor->attributes()->edad;
