Skip to content

Instantly share code, notes, and snippets.

@dg
Created June 20, 2013 18:59
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dg/5825595 to your computer and use it in GitHub Desktop.
Save dg/5825595 to your computer and use it in GitHub Desktop.
How can I find out where my output started?
<?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);
@dg
Copy link
Author

dg commented Jun 20, 2013

Must be placed on the top of very first PHP file. (But is unable to detect BOM in this file.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment