Possible Duplicate:
capturing echo into a variable
I have a function that echos a string. Is their any way (besides altering the function) that I can negate the echo statement?
example:
function echo_string(){
echo "This is a string";
}
$dont_echo = negate_echo(echo_string());
$dont_echo .= ", a negated string";
echo $dont_echo; // "This is a string, a negated string";
Is their anything like negate_echo?
That is: Starting a new output buffer, execute the function, get the buffers content and close it. See
ob_get_cleanDocs.