3v4l.org

run code in 300+ PHP versions simultaneously
<?php // ClassA.php class A { public function __construct(){print "Init";} public function bye(){print "Hey :)";} } //ScriptAClassAction.php $class = new A(); $reflection = new ReflectionClass($class); if (!empty($reflection) && $reflection->hasMethod('hello')){ if($reflection->hasMethod('init')) $class->init($request, $response); //Prints 'Init called' if($reflection->hasMethod('preDispatch')) $class->preDispatch(); // 'Predispatch called' $class->hello(); if($reflection->hasMethod('postDispatch')) $class->postDispatch(); // 'post dispatch called'.. } else { if (!$reflection) // I know this might not be the best check but.. print "Not a valid class supplied"; if (false == $reflection->hasMethod('hello')) // True trigger print "Supplied class does not have any manners and does not greet you :D"; // This is the expected output and it should be the only output }
Output for git.master, git.master_jit, rfc.property-hooks
InitSupplied class does not have any manners and does not greet you :D

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