From the php documentation i came across the following function:
string number_format ( float $number , int $decimals = 0 ,
string $dec_point = '.' , string $thousands_sep = ',' )
This function accepts either one, two, or four parameters (not three). When passed three arguments, the function generates a warning Warning: Wrong parameter count for number_format() on the line of function call.
From what I understand, any optional parameter should be totally optional. Also, php does not support function overloading so that we could have made two different functions to achieve this.
My questions are:
Is it possible to somehow restrict the number of arguments as above in the function declaration itself (not within the function code)
If not, and that the above function uses
trigger_error()to generate the warning, how does the generated warning refer to the file and line from where this function is being called from.trigger_error()function seems to generate a warning / error on the line it is called.