capturing echo into a variable
<p>I am calling functions using dynamic function names (something like this)</p>

<pre><code>$unsafeFunctionName = $_POST['function_name'];
$safeFunctionName   = safe($unsafeFunctionName); // custom safe() function
</code></pre>

<p>Then I am wanting to wrap some xml around the returned value of the function (something like this):</p>

<pre><code>// xml header etc already created
$result = "&lt;return_value&gt;" . $safeFunctionName() . "&lt;/return_value&gt;";
</code></pre>

<p>Problem is, sometimes the function returns a value, but sometimes, the function echo's a value. What I want to do is capture that echo into a variable, but, the code I write would need to work either way (meaning, if function returns a value, or echo's a string).</p>

<p>Not quite sure where to start ~ any ideas?</p>
