debug_backtrace gives you a context
Pros
- Easy to add to your code
- Shows you call traces
- Gives detailed environment info
Cons
- Can produce huge masses of output
<?php
class Foo {
public function __construct( $foo ) {
$this->init( $foo, 23 );
}
public function init( $foo, $bar ) {
echo "Here is $foo, $bar<br/>";
var_dump( debug_backtrace() );
}
}
echo "<pre>";
$foo = new Foo();
echo "</pre>";
?>
Output