I want to generate xml by using php simplexml.
$xml = new SimpleXMLElement(\' \');
$output = $xml->addChild(\'child1\');
$output->addChild(
Despite the quite lengthy answers already given - which are not particularly wrong and do shed some light into some libxml library internals and it's PHP binding - you're most likely looking for:
$output->noValue = '';
To add an open tag, empty node-value and end tag (beautified, demo is here: http://3v4l.org/S2PKc):
value
Just noting as it seems it has been overlooked with the existing answers.