Confused on PHP func_num_args() Function
<p>Following a Tutorial I am struggling with an issue in a PHP function. I have some basic background on C# and Java and according to my knowledge this code shouldn't work since I am not passing any parameter in the add() function, but , surprisingly!, it works! <br />
According to <a href="http://php.net/manual/en/function.func-num-args.php" rel="nofollow">PHP Manual</a> the func_num_args() Gets the number of arguments passed to the function.so how we can echo the result of the add() function while we are not passing any parameter in the function?! Also, if the function is for getting the number of arguments how we can use it to calculate the numbers?!</p>

<pre><code>&lt;?php
 function add(){
  $args  = func_num_args();
  $sum  = 0; 
  $i    = 0;
  for($i; $i&lt; $args; $i++ ){
   is_int(func_num_args($i)) ? $sum+= func_num_args($i) : die('Use Only Numbers');
 }
}

echo add(2,5,10,12);
?&gt;
</code></pre>

<p>Thanks for your comments</p>
