Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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