0

How do I set Moo to the element, like this:

$xmlEl = new SimpleXMLElement('<Get>Moo</Get>'); 

If I initialised the element like this instead:

$xmlEl = new SimpleXMLElement('<Get></Get>'); 

It's something ridiculously simple. But I know it's neither addAttribute() nor addChild().

Thanks in advance

1 Answer 1

1

Set value of the root element:

<?php $xmlEl = new SimpleXMLElement('<Get></Get>'); $xmlEl[0] = 'Moo'; ?> 
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.