AW: [PHP] String. If contains

From: Date: Wed, 30 Aug 2000 12:45:55 +0000
Subject: AW: [PHP] String. If contains
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-14388@lists.php.net to get a copy of this message
try this: <? $source = "Hello out there!"; $search = "out"; if (!preg_match("/(.*)$search(.*)/", $source, $results)) { echo "NOTHING FOUND!\n"; } ?> > -----Ursprüngliche Nachricht----- > Von: Anders Dannberg [mailto:anders.dannberg@edk.se] > Gesendet am: Mittwoch, 30. August 2000 11:03 > An: php-general@lists.php.net > Betreff: [PHP] String. If contains > > Hello! > > I need to know if a string contains a word (or character). What's the best > solution for this? > Please see below. This is what i need to know how to do.... > > $string = "It's a sunny morning in Sweden today!" > if ($string contains "sunny") { > echo "the string contained the > value "sunny"; > } > > Thanks in advance. > Anders > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#14388) next »