RE: [PHP] problem with if and exact match
| From: | Jack | Date: | Tue, 15 Mar 2011 05:20:00 +0000 |
| Subject: | RE: [PHP] problem with if and exact match | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311854@lists.php.net to get a copy of this message | ||
Thanks everyone... great examples...works.... ( both methods )
Thanks!
Jack
> -----Original Message-----
> From: Alexis Antonakis [mailto:admin@antonakis.co.uk]
> Sent: Tuesday, March 15, 2011 1:10 AM
> To: Jack
> Subject: Re: [PHP] problem with if and exact match
>
> http://php.net/manual/en/function.preg-match.php
>
> On 14/03/11 23:02, Jack wrote:
> > I want to be able to match if a string is contained within the string
> > I am evaluating.
> >
> >
> >
> > I know that if ( $name == "xxjacksonxx"); based on the below would be
> true.
> >
> > But I want to be able to say if "jackson" is contained within $name
> > that it's a match.
> >
> >
> >
> > I tried the below without success..
> >
> > Not getting the operand properly..
> >
> >
> >
> > <?
> >
> >
> >
> > $name = "xxjacksonxx";
> >
> >
> >
> > if ( preg_match($name, "jackson")) {
> >
> > print "true";
> >
> >
> >
> > } else {
> >
> >
> >
> > print "false";
> >
> > }
> >
> >
> >
> > ?>
> >
> >
> >
> > Thanks!
> >
> > Jack
> >
> >
> >
> >