3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public static $transport = array(); public function do_stuff() { $test = self::get_transport(); return $test->do_stuff(); } protected static function get_transport(){ $tests = array( 'Test_this', 'Test_that' ); foreach( $tests as $class ) { $result = call_user_func(array($class, 'test')); if ($result) { self::$transport[] = $class; break; } } return new self::$transport[0](); } } class Test_this { public function do_stuff(){ return "this"; } public static function test(){ return false; } } class Test_that { public function do_stuff(){ return "that"; } public static function test(){ return true; } } $a = new Test; var_dump( $a->do_stuff() );
Output for git.master, git.master_jit, rfc.property-hooks
string(4) "that"

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:
63.23 ms | 401 KiB | 8 Q