File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / 001.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    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>