The "parameters" of a function, that is, what is received when the function is called, are described in the declaration of that function. This declaration may specify the type of value expected (integer, table, character string…), a default value, and most importantly the name of the variable where the usable parameter is stored within the function’s code. In PHP we have:

  1. function name($param1, $param2=0){}

This "name" function will receive two "parameters" when it is called, stored in the local variables $param1 and $param2 (which will have a value of 0 by default). We may then call this particular function with either 1 or 2 "arguments":

  1. name('Extra'); // param2 will equal 0
  2. name('Extra', 19);


Author Mark Baber Published : Updated : 02/06/10

Translations : English, français