3v4l.org

run code in 300+ PHP versions simultaneously
<?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(); } } function class_alias_kinda($original, $alias) { eval("class $alias extends $original {}"); } class_alias_kinda('First', 'Second'); $aliased = new Second(); $aliased->test1(); // Second $aliased->test2(); // array( 0 => array( ... [object] => Second Object, ... ) ) $aliased->test3(); // Second $aliased->test4(); // First (this is expected) Second::test5(); // Second
Output for git.master, git.master_jit, rfc.property-hooks
SecondArray ( [0] => Array ( [file] => /in/vfYn2 [line] => 18 [function] => test2 [class] => First [object] => Second Object ( ) [type] => -> [args] => Array ( ) ) ) SecondFirstSecond

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
52.12 ms | 406 KiB | 5 Q