I\'m using a PHP library that echoes a result rather than returns it. Is there an easy way to capture the output from echo/print and store it in a variable? (Other text has
Its always good practise not to echo data until your application as fully completed, for example
now session_start
along with another string of functions would not work as there's already been data outputted as the response, but by doing the following:
This would work and its less error prone, but if its a must that you need to capture output then you would do:
ob_start();
//Whatever you want here
$data = ob_get_contents();
//Then we clean out that buffer with:
ob_end_clean();