As what Nog has done, inside the argument parameters for the function itself, any variables that are 'optional' (that is to say, optional in the calling to the function as in a('Hello') ) must be equal to something. This gives those optional parameters a default value with which the function can work with. This is a great way to setup default values and only have the programmer call a function with values that need to be set [and leave the defaults alone if one doesn't want to override them]).
I think that you must have all your 'optional' argument parameters listed at the end. By example, this would not work:
function foo($a, $b='I am a default value', $c) {
// do something
}
because if you were to try and call this function, how would you do it? The following would generate an error:
foo('I am value of $a inside the function', ,'I am intended on being the value of $c');
How about this?
foo('I am value of $a inside the function', 'I am intended on being the value of $c');
The assignation of $a is correct, but the second (and final) parameter being passed would be assigned to $b (it would overwrite $b's default value) as the order of values being passed to the function get assigned to the argument parameters within the function in the same order. However, the function requires 3 parameters to be passed, because the optional one isn't listed at the end..So where is the value of $c?
So the example would have to be re-written as such:
function foo($a, $c, $b='I am a default value') {
// do something
}
foo('I am value of $a inside the function', 'I am intended on being the value of $c');
This will work fine, as the third parameter ($b) is truly optional due to it's value already being assigned something as well as being listed at the end..(you list all your optionals at the end).