Created
June 20, 2013 18:59
-
-
Save dg/5825595 to your computer and use it in GitHub Desktop.
How can I find out where my output started?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ob_start(function($s, $flag) { | |
if ($flag & PHP_OUTPUT_HANDLER_START) { | |
$e = new \Exception; | |
$s = nl2br("Output started here:\n{$e->getTraceAsString()}\n\n") . $s; | |
} | |
return $s; | |
}, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Must be placed on the top of very first PHP file. (But is unable to detect BOM in this file.)