Returning a variable from a function in php (return not working)
<p>I'm building an XML page inside of a function, and for some strange reason I don't get the whole thing spit out of the function. I've tried </p>

<pre><code>return $thisXml;
}
echo $thisXML;
</code></pre>

<p>and I only get the xml declaration which is in the variable before the function. 
If i put an echo in the function, i get everything back as I should. </p>

<p>my page essentially looks like this</p>

<pre><code>$thisXml = 'xml declaration stuff';

function getThisXML($thisXML){
  for(i=1; i&lt;5; i++){
  $query "has the 5 in it";

  while ($mysqlQuery =mysql_fetch_array($theQuery) {
    $thisXml.='add the xml';
  }
  $thisXml.='close the last element';
  return $thisXml;
}

echo $thisXml;
</code></pre>

<p>as i said, if I replace the 'return' with 'echo', I get all the nice xml. if I echo outside the function, I only get the original declaration. </p>

<p>really strange, and i've been struggling with this one all day. </p>
