RE: loking for a item in string?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I'd rather suggest using strpos(), seen as it's quite a bit faster than
> using a regular expression engine (especially when you don't need one)
> 
> Greg Donald wrote:
> > On Sat, 6 Nov 2004 21:58:49 -0600, Dustin Wish with INDCO Networks
> > <dwish@xxxxxxxxx> wrote:
> >
> >>I am opening a file and then have to look for a value inside the string.
> Is
> >>there an easy way to do this?
> >>
> >>I need the value in this string for the var djLast = '45.119999';
> >
> >
> >
> > preg_match() can do that.
> >
> > php.net/preg_match

>From how I read the question, preg_match is the better approach. I don't
think Dustin is attempting to simply verify that the substring is in the
string, but is attempting to return the value that appears between the
single quote characters after the existence of 'djLast = '. Presumably this
value could be '45.119999', as in his example, or '26.3333333', or
'98.123456' and so on. I think Dustin is attempting to find out what that
value is.

preg_match is how I'd achieve this as well.

Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux