Any ideas? Where is the function that needs to be returned instead of echoed?
I'm going to offer an alternative solution that does not require you to replace instances of echo or build a return string.
You can turn on output buffering and return the buffer as a string.
Add ob_start()
to the beginning of the function before any echo call.
at the end of the function add:
$response = ob_get_contents();
ob_end_clean();
return $response;