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 require 'ClassA.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
Warning: require(): open_basedir restriction in effect. File(ClassA.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Dgga5 on line 11 Warning: require(ClassA.php): Failed to open stream: Operation not permitted in /in/Dgga5 on line 11 Fatal error: Uncaught Error: Failed opening required 'ClassA.php' (include_path='.:') in /in/Dgga5:11 Stack trace: #0 {main} thrown in /in/Dgga5 on line 11
Process exited with code 255.

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