Re: eregi() not doing what I think it'a meant to...
| From: | Rasmus Lerdorf | Date: | Mon, 03 Jul 2000 18:01:07 +0000 |
| Subject: | Re: eregi() not doing what I think it'a meant to... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4543@lists.php.net to get a copy of this message | ||
I think you are confusing the argument order. The first argument is the
regular expression. The second is the string that regex will be applied
to.
So, you are effectively asking if the regex "Neil" matches the string
"ei", which it doesn't.
You probably want to swap your arguments.
-Rasmus
On Mon, 3 Jul 2000, Daniel Vesma wrote:
> I couldn't find an FAQ, so please excuse me if this has been asked before...
>
> Correct me if I'm wrong, but if $row->NAME is "Neil", and $type is
> "ei" then
> the following code...
>
> if($type == "" OR eregi($row->NAME, $type))
> {
> print "Yup";
> }
> else {
> print "Nope";
> }
>
>
> should print "Yup" to the screen. It doesn't. If $type is "Neil", then
> it
> does.
>
> Am I wrong on this? Am I using the wrong syntax?
>
> Thanks for any help.
>
> Daniel Vesma - IT and Webdesign Manager
> The Web Tree: http://www.thewebtree.com
>
>
>
>