fork download
  1. <?php
  2.  
  3. class MyClass {
  4. public static function __callStatic( string $name, array $args ) {
  5. $args[0]->say();
  6. return "\nmethod name = $name, args = " . var_export($args, 1);
  7. }
  8. }
  9.  
  10. class Cat {
  11. public function say() {
  12. echo 'meow!';
  13. return 1;
  14. }
  15. }
  16.  
  17. $cat = new Cat();
  18.  
  19. echo MyClass::test($cat, 42, 'foo');
  20.  
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
meow!
method name = test, args = array (
  0 => 
  Cat::__set_state(array(
  )),
  1 => 42,
  2 => 'foo',
)