Returning a variable from a function in php (return not working)
return $thisXml;
}
echo $thisXML;
$thisXML; only exists in the scope of the function.
Either make $thisXML; global (bad idea) or echo getThisXML()
where getThisXML is the function that returns $thisXML
;
Are you actually calling the function in the sense of:
$thisXml = getThisXML($someinput);
Maybe a silly question, but I don´t see it in your description.
You need to invoke the function!
$thisXml = 'xml declaration stuff';
echo getThisXML($thisXML);
Or pass the variable by reference:
$thisXml = 'xml declaration stuff';
function getThisXML(&$thisXML){
...
return $thisXml;
}
getThisXML($thisXML);
echo $thisXml;