-1

I'm using XML for the use of different languages. First of all, I'm not used to work with XML so I want to ask if I'm doing it right. Here is my XML code:

<lang>
    <one>
        <ENG>Text1</ENG>
        <NL>Text2</NL>
    </one>
</lang>

When I load this in php I get this array:

SimpleXMLElement Object ( [one] => SimpleXMLElement Object ( [ENG] => Text1 [NL] => Text2 ) )

I'm now trying to get each single element out of the XML, I have this code:

$xml = simplexml_load_file($file);
$result = $xml['one']['ENG'];

But it doesn't return any result, please help.

Thanks.

hakre
  • 193,403
  • 52
  • 435
  • 836
deleted
  • 23
  • 4

1 Answers1

1

Use object accessor syntax instead:

$result = $xml->one->ENG;
raina77ow
  • 103,633
  • 15
  • 192
  • 229