Re: Newbie - is there a function similar to the sql 'like' comparison operator?
[email protected] (Colin Guthrie)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
revDAVE wrote: > Newbie - is there a function similar to the sql 'like' comparison operator? > > I would like to be able to compare 2 strings: > > If $this ---*like or similar to*--- $that > > That type of thing... I strongly suggest you read up on regular expressions: http://uk.php.net/manual/en/book.regex.php Knowing how to use regular expressions is a a very handy skill. I do a lot of mass changing of files via the command line with tools such as grep, sed and awk and a mastery regular expressions can save hours of laborious typing and find/replacing ;) Reminds me of one of my favourite xkcd cartoons: http://xkcd.com/208/ Col