- debug_backtrace: documentation ( source)
- class_alias: documentation ( source)
- print_r: documentation ( source)
<?php
class First {
public function test1() { echo get_called_class(); }
public function test2() { print_r(debug_backtrace()); }
public function test3() { echo get_class($this); }
public function test4() { echo __CLASS__; }
public static function test5() { echo get_called_class(); }
}
class_alias('First', 'Second');
$aliased = new Second();
$aliased->test1(); // First
$aliased->test2(); // array( 0 => array( ... [object] => First Object, ... ) )
$aliased->test3(); // First
$aliased->test4(); // First
Second::test5(); // First