[ create a new paste ] login | about

Link: http://codepad.org/X9TAeiIR    [ raw code | output | fork ]

php.programmer - PHP, pasted on Apr 13:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
// sample code for Variable-length argument lists kind of functions
function me($iAnmDefault='2')
{ 
  $arguments = func_get_args();
  /* see carefully func_get_args() works for only the arguments 
    which are passed in function call and not for default arguments.
  */ 
  foreach($arguments as $arg)
   {
     echo $arg;
   }
  echo "\n";
}
me('1');
me('1','2');
me('1','2','3');
?>


Output:
1
2
3
1
12
123


Create a new paste based on this one


Comments: