[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    RE: [PHP] returning early from a function.
From:       "Vail, Warren" <Warren.Vail () schwab ! com>
Date:       2003-12-31 17:17:48
Message-ID: 72138202E59CD6118E960002A52CD9D20D2A87A8 () n1025smx ! nt ! schwab ! com
[Download RAW message or body]

Try;

if($s == 'this') return false;
	A
	*-----------------  single = is an assignment.

Warren Vail



-----Original Message-----
From: Chris W [mailto:1qazse4@cox.net]
Sent: Monday, December 29, 2003 9:07 AM
To: php-general@lists.php.net
Subject: [PHP] returning early from a function.


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 make this work or why it doesn't work?


Chris W

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic