Re: or return problem

From: Date: Wed, 08 Oct 2003 15:42:49 +0000
Subject: Re: or return problem
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-165463@lists.php.net to get a copy of this message
On Wed, 2003-10-08 at 11:43, Curt Zirzow wrote: > * Thus wrote Chris Shiflett (shiflett@php.net): > > --- "Ford, Mike [LSS]" <M.Ford@lmu.ac.uk>" <M.Ford@lmu.ac.uk> > > wrote: > > > Firstly, "or", as a Boolean operator requires two operands, both of > > > which must have an actual value. > > > > [snip] > > > > > statements don't have a value (and can't even be coerced to have > > > one), so "return" can't be valid as one of the operands to > > > "or". > > > > Based on yesterday's discussion, this seems to be a very common misconception. > > I will try to clear it up. > > To add this, the 'include' family also accepts this construct: > > condition or include(file); > > Which also violates the rule that statments (constructs) dont have return > values. > This isn't a rule per se since it really depends on whether special treatment was given to the construct. The internals developers probably didn't see a need to provide support for "return" in conditionals since it can't return a value to the conditional. Incidentally does return in this manner work in perl since it appears that's what the "or die()" stuff is attmepting to mimic. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#165463) next »