Annotation of embedaddon/php/Zend/tests/001.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: func_num_args() tests
3: --FILE--
4: <?php
5:
6: function test1() {
7: var_dump(func_num_args());
8: }
9:
10: function test2($a) {
11: var_dump(func_num_args());
12: }
13:
14: function test3($a, $b) {
15: var_dump(func_num_args());
16: }
17:
18: test1();
19: test2(1);
20: test2();
21: test3(1,2);
22:
23: call_user_func("test1");
24: call_user_func("test3", 1);
25: call_user_func("test3", 1, 2);
26:
27: class test {
28: static function test1($a) {
29: var_dump(func_num_args());
30: }
31: }
32:
33: test::test1(1);
34: var_dump(func_num_args());
35:
36: echo "Done\n";
37: ?>
38: --EXPECTF--
39: int(0)
40: int(1)
41:
42: Warning: Missing argument 1 for test2(), called in %s on line %d
43: int(0)
44: int(2)
45: int(0)
46:
47: Warning: Missing argument 2 for test3() in %s on line %d
48: int(1)
49: int(2)
50: int(1)
51:
52: Warning: func_num_args(): Called from the global scope - no function context in %s on line %d
53: int(-1)
54: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>