'PHP - Write console output to file AND to console?

I want to write the console output to a file AND to the console itself. To write the console output to a file I'm using this:

ob_start();
...
...
$output = ob_get_contents();
file_put_contents("cronjob.txt", $output, FILE_APPEND);
ob_flush();

But now I want also to print the output to the console instand of just writing it to a file. Is that possible and if yes, how can I do that?

Greetings and Thank You!



Solution 1:[1]

Why not try bebugging tools like

  1. Xdebug Link for chrome
  2. Xdebug Toggler for Safari

I use these and it works pretty good.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lojolis