I have this code:
include('file1.php');
include('file2.php');
include('lib1.php');
include('lib2.php');
include('lib3.php');
function __autoload($c) { include('classes/'.$c.'.php'; }
$obj = new Class1();
$obj->method();
...
In $obj->method
, there's some functionality to add cookies. I got headers already sent error. So I added var_dump(headers_sent());
and I see a very strange behavior. Here's what I did:
// ... the same code above
var_dump(headers_sent()); // False
$obj = new Class1(); // True, the first line of __cunstruct() inside
$obj->method(); // True, the first line of method()
var_dump(headers_sent()); // True
...
This is strange; how just between the single line headers are sent? How is this possible?