If you look back to the original problem, switch was matching the 0 returned
from preg_match to a string.  However, if the return value is a boolean it
would not match 0 to a string.  However, I guess it would then match the
true to a string.

Brian Moon
------------------------------------------
dealnews.com, Inc.
Makers of dealnews & dealmac
http://dealnews.com/ | http://dealmac.com/


----- Original Message -----
From: "Jon Parise" <[EMAIL PROTECTED]>
To: "Brian Moon" <[EMAIL PROTECTED]>
Cc: "Andrei Zmievski" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, July 02, 2001 7:21 PM
Subject: Re: [PHP-DEV] switch, equality and preg_match


> On Mon, Jul 02, 2001 at 05:01:43PM -0500, Brian Moon wrote:
>
> > IMO, I like preg_match to return a bool and preg_match_all return a
count.
> > But that is me.  It may be thought of as inconsistent to some.  I just
see
> > the functions has having a different purpose.
>
> That would make sense.  preg_match_all() would return 1 if only
> one match is found, so there's no need for preg_match() to return
> the number of matches.
>
> However, even if preg_match() were to return a one or zero, it
> would still function the same in boolean evaluations.  That makes
> the whole thing simply a matter of "correctness".  Returning an
> 'int' would be more consistent but returning a boolean would be
> specific.
>
> --
> Jon Parise ([EMAIL PROTECTED])  .  Rochester Inst. of Technology
> http://www.csh.rit.edu/~jon/  :  Computer Science House Member
>
>


-- 
PHP Development 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]

Reply via email to