Re: switch, equality and preg_match

From: Date: Tue, 03 Jul 2001 00:21:50 +0000
Subject: Re: switch, equality and preg_match
References: 1 2 3 4 5 6  Groups: php.dev 
Request: Send a blank email to php-dev+get-58762@lists.php.net to get a copy of this message
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 (jon@csh.rit.edu) . Rochester Inst. of Technology http://www.csh.rit.edu/~jon/ : Computer Science House Member

« previous php.dev (#58762) next »