i want the properties of it to be optional, by that i mean:
Code: Select all
function displayRegForm($username, $email, $ad1, $ad2, $ad3, $postcode){
}how can i say that, or cant i?
ive looked on the manual but cant see anything.
thanks.
Moderator: General Moderators
Code: Select all
function displayRegForm($username, $email, $ad1, $ad2, $ad3, $postcode){
}Code: Select all
function my_func($var1 = '', $var2 = 0, $var3 = false, $var4 = 'this is a default value') {...}Oren wrote:You just give each one of them a default value - an empty string, 0, false or anything else...Code: Select all
function my_func($var1 = '', $var2 = 0, $var3 = false, $var4 = 'this is a default value') {...}