-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.

1

1 Answer 1

1

Use object accessor syntax instead:

$result = $xml->one->ENG;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.