[PHP] returning early from a function.

2003-12-31 Thread Chris W
I have a function that does several tests and if any are true it needs to return false but I get an error about unexpected return for all returns except for the last one. function test($s) { if($s = 'this') return false; if($s = 'that') return false; return true; } any ideas on how to

RE: [PHP] returning early from a function.

2003-12-31 Thread Vail, Warren
Try; if($s == 'this') return false; A *- single = is an assignment. Warren Vail -Original Message- From: Chris W [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 9:07 AM To: [EMAIL PROTECTED] Subject: [PHP] returning early from a function. I

Re: [PHP] returning early from a function.

2003-12-31 Thread Matt Matijevich
[snip] function test($s) { if($s = 'this') return false; if($s = 'that') return false; return true; } [/snip] try this: function test($s) { if($s == 'this') return false; if($s == 'that') return false; return true; } -- PHP General Mailing List (http://www.php.net/) To