ll = whatever $zip's current value is, and will NOT
be changed to ?
S> Please advise.
S> Thanks Martin
S> -Original Message-
S> From: Martin Towell [mailto:[EMAIL PROTECTED]]
S> Sent: Tuesday, September 10, 2002 5:14 PM
S> To: Shane; [EMAIL PROTECTED]
S> Su
ld be null, "", or "foobar", it doesn't matter, $zip will = $var3
Martin
-Original Message-
From: Shane [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 10:22 AM
To: Martin Towell; [EMAIL PROTECTED]
Subject: RE: [PHP] Easy Function Question?
Martin, so
-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 5:14 PM
To: Shane; [EMAIL PROTECTED]
Subject: RE: [PHP] Easy Function Question?
function myFunction($name, $phone, $zip=""){
echo $name.$phone.$zip
}
is the corrent format, but
($name, $phone, $zip=""){
if (!$zip) $zip = "";
echo $name.$phone.$zip
}
HTH
Martin
-Original Message-
From: Shane [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 10:14 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Easy Function Question?
I have a
I have a need to call a function, where all the variables used might not be set. Is
there a way to have a variable in a function have a default setting if the variable
passed to the function is VOID?
EXAMPLE:
$name="me";
$phone="";
//$zip is VOID
function myFunction($name, $phone, $zip){
5 matches
Mail list logo