method.phpt 392 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. Unpack arguments for method calls
  3. --FILE--
  4. <?php
  5. class Foo {
  6. public function test(...$args) {
  7. var_dump($args);
  8. }
  9. public static function test2(...$args) {
  10. var_dump($args);
  11. }
  12. }
  13. $foo = new Foo;
  14. Foo::test2(1, 2, ...[3, 4], ...[], ...[5]);
  15. ?>
  16. --EXPECT--
  17. array(5) {
  18. [0]=>
  19. int(1)
  20. [1]=>
  21. int(2)
  22. [2]=>
  23. int(3)
  24. [3]=>
  25. int(4)
  26. [4]=>
  27. int(5)
  28. }