How can I make at least one of the two arguments optional to supress the "Warning: Missing argument 2" error message?
Cheers,
asp
ruserious
10:51 am on May 13, 2003 (gmt 0)
You can give it a default value:
function name( $var1, $var2=NULL ) { stuff... }
aspr1n
11:29 am on May 13, 2003 (gmt 0)
he he didn't think to try this in PHP!
Cheers,
cidrolin
11:01 am on May 15, 2003 (gmt 0)
I believe prefixing the function call with "@" character will prevent warning output; it's also possible to modify php error-reporting level using the error_reporting() php function .
BCMG_Scott
6:48 pm on May 15, 2003 (gmt 0)
Another idea is to use the func_get_args() and func_num_args() functions.