I still haven't worked with xml files, but now I'm trying to get an XML file into a php array or object. The xml file is as follows: (it is for translating a web application)
<?xml version="1.0" ?>
<content language="de">
<string name="login">Login</string>
<string name="username">Benutzername</string>
<string name="password">Passwort</string>
</content>
I tried the following:
$xml = new SimpleXMLElement("de.xml", 0, 1);
print_r($xml);
Unfortunately, the value of the 'name' attribute is for some reason not in the php object. I am looking for a way that allows me to get xml values using the name attribute.
eg:
$xml['username'] //returns "Benutzername"
How can I do that? appreciate your help :) greetings!
source
share