File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / 003.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_get_args() tests
    3: --FILE--
    4: <?php
    5: 
    6: function test1() {
    7: 	var_dump(func_get_args());
    8: }
    9: 
   10: function test2($a) {
   11: 	var_dump(func_get_args());
   12: }
   13: 
   14: function test3($a, $b) {
   15: 	var_dump(func_get_args());
   16: }
   17: 
   18: test1();
   19: test1(10);
   20: test2(1);
   21: test2();
   22: test3(1,2);
   23: 
   24: call_user_func("test1");
   25: call_user_func("test3", 1);
   26: call_user_func("test3", 1, 2);
   27: 
   28: class test {
   29: 	static function test1($a) {
   30: 		var_dump(func_get_args());
   31: 	}
   32: }
   33: 
   34: test::test1(1);
   35: var_dump(func_get_args());
   36: 
   37: echo "Done\n";
   38: ?>
   39: --EXPECTF--	
   40: array(0) {
   41: }
   42: array(1) {
   43:   [0]=>
   44:   int(10)
   45: }
   46: array(1) {
   47:   [0]=>
   48:   int(1)
   49: }
   50: 
   51: Warning: Missing argument 1 for test2(), called in %s on line %d and defined in %s on line %d
   52: array(0) {
   53: }
   54: array(2) {
   55:   [0]=>
   56:   int(1)
   57:   [1]=>
   58:   int(2)
   59: }
   60: array(0) {
   61: }
   62: 
   63: Warning: Missing argument 2 for test3() in %s on line %d
   64: array(1) {
   65:   [0]=>
   66:   int(1)
   67: }
   68: array(2) {
   69:   [0]=>
   70:   int(1)
   71:   [1]=>
   72:   int(2)
   73: }
   74: array(1) {
   75:   [0]=>
   76:   int(1)
   77: }
   78: 
   79: Warning: func_get_args():  Called from the global scope - no function context in %s on line %d
   80: bool(false)
   81: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>