title: How to prevent echo in PHP and catch what it is inside?
body: <p>I have a function ( <code>DoDb::printJsonDG($sql, $db, 1000, 2)</code> ) which echos json. I have to catch it and then use str_replace() before it is send to the user. However I cannot stop it from doing echo. I don't want to change printJsonDG because it is being used in several other locations.</p>