3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class EventManager { public static function call($sEvent) { $aClasses = ['B']; foreach ($aClasses as $sClassName) { $oMethodChecking = new ReflectionMethod($sClassName,$sFunctionName); $sFunctionName = 'event_'.$sEvent; if (method_exists($sClassName, $sFunctionName) && $oMethodChecking->isStatic()) { call_user_func($sClassName.'::'.$sFunctionName); } } } } final class B { public static function event_event_name() { echo 'ok'; } } EventManager::call('event_name');
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $sFunctionName in /in/UpOX8 on line 9 Fatal error: Uncaught ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name in /in/UpOX8:9 Stack trace: #0 /in/UpOX8(9): ReflectionMethod->__construct('B', NULL) #1 /in/UpOX8(25): EventManager::call('event_name') #2 {main} thrown in /in/UpOX8 on line 9
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:
45.32 ms | 401 KiB | 8 Q