Re: array search
| From: | Martín Marqués | Date: | Fri, 31 Aug 2001 21:11:17 +0000 |
| Subject: | Re: array search | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65554@lists.php.net to get a copy of this message | ||
On Vie 31 Ago 2001 17:49, you wrote:
> What about going the other way? Say I have a sentence...
>
> "Hi, my name is Bob."
>
> ...and I want to search the sentence for one of the values (people) in the
> array...
>
> $people = array("Jim","John","JP","Bob");
>
> Can this be done?
Yes, split the sentence into parts of the array (use split or explode), then
all you have to do is walk through $people with foreach askink if that word
is in, for example $word that is the array that you got after the split (or
explode).
Saludos,.... :-)
--
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués | mmarques@unl.edu.ar
Programador, Administrador, DBA | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------