run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test { protected static function myProtected($test) { var_dump(__METHOD__, $test); } public static function __callStatic($method, $args) { switch($method) { case 'foo' : echo 'You have called foo()'; var_dump($args); break; case 'helloWorld': echo 'Hello ' . $args[0]; break; case 'myProtected': return call_user_func_array( array(get_called_class(), 'myProtected'), $args ); break; default: echo "doesn't exist, sorry"; break; } } } Test::notFound(); Test::myProtected("hello"); Test::helloWorld("Nico");
based on 7AVYf
Output for 7.3.0alpha1 - 7.3.0rc3
doesn't exist, sorry Fatal error: Uncaught ArgumentCountError: Too few arguments to function Test::myProtected(), 0 passed in /in/2DqqV on line 22 and exactly 1 expected in /in/2DqqV:4 Stack trace: #0 /in/2DqqV(22): Test::myProtected() #1 /in/2DqqV(35): Test::__callStatic('myProtected', Array) #2 {main} thrown in /in/2DqqV on line 4
Process exited with code 255.
Output for 5.6.0 - 7.2.11
doesn't exist, sorrystring(17) "Test::myProtected" string(5) "hello" Hello Nico