func_get_arg.004.phpt 352 B

123456789101112131415161718
  1. --TEST--
  2. func_get_arg on non-existent arg
  3. --FILE--
  4. <?php
  5. function foo($a)
  6. {
  7. try {
  8. var_dump(func_get_arg(2));
  9. } catch (\Error $e) {
  10. echo $e->getMessage() . \PHP_EOL;
  11. }
  12. }
  13. foo(2, 3);
  14. ?>
  15. --EXPECT--
  16. func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function