[PHP] Re: how to pass true/false or no argument

2001-10-29 Thread John A. Grant

John A. Grant [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
[...]
 How do I distinguish between false and $xxx parameter not
 passed? Do I use isset()? Do I use ===?

Well, I guess I should have done some homework first. This
code seems to work fine:

function somefunction($text,$xxx=null)
{
if(isset($xxx)){
echo $xxx ? true : false;
}else{
echo null;
}
echo \n;
}

somefunction(hello);
somefunction(hello,true);
somefunction(hello,false);


It prints:
null
true
false

which is what I want.

--
John A. Grant  * I speak only for myself *  (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: how to pass true/false or no argument

2001-10-29 Thread Richard Hollis

yeah, but i wanted to know the answer... so it wasn't a total waste of time
:)

John A. Grant [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 John A. Grant [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 [...]
  How do I distinguish between false and $xxx parameter not
  passed? Do I use isset()? Do I use ===?

 Well, I guess I should have done some homework first. This
 code seems to work fine:




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]