Optional parameters for custom functions.
Posted: Sun Dec 22, 2002 12:59 pm
Hi.
I wonder how i should do to have parameters optional and not required
for custom functions, like some of the built in function.
For example.
for my site i have this function called:
send_message( $message, $notice ), where $notice should be a optional parameter.
It simply draws a message on screen.
Now, if it is a warning you should set parameter 2 to:
1 = notice,
2 = varning,
3 = critical
If i leave $notice blank it just gives me the "wrong parameter count for function..." message.
Thank you for your time,
Best Regards,
Owe Blomqvist
I wonder how i should do to have parameters optional and not required
for custom functions, like some of the built in function.
For example.
for my site i have this function called:
send_message( $message, $notice ), where $notice should be a optional parameter.
It simply draws a message on screen.
Now, if it is a warning you should set parameter 2 to:
1 = notice,
2 = varning,
3 = critical
If i leave $notice blank it just gives me the "wrong parameter count for function..." message.
Thank you for your time,
Best Regards,
Owe Blomqvist