php伪重载

 1  function otest1 ($a)
 2  6    {
 3  7        echo( '一个参数' );
 4  8    }
 5  9
 6 10    function otest2 ( $a, $b)
 7 11    {
 8 12        echo( '二个参数' );
 9 13    }
10 14
11 15    function otest3 ( $a ,$b,$c)
12 16    {
13 17        echo( '三个啦' );
14 18    }
15 19
16 20    function otest ()
17 21    {
18 22        $args = func_get_args();
19 23        $num = func_num_args();
20 24        call_user_func_array( 'otest'.$num, $args  );
21 25    }
22 26
23 27    otest(1,2);

url:http://www.cnitblog.com/neatstudio/archive/2012/07/12/13990.html

posted @ 2013-04-19 16:00  3wmao  阅读(104)  评论(0编辑  收藏  举报