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