Re: AW: [PHP] String. If contains
| From: | Wico de Leeuw | Date: | Wed, 30 Aug 2000 15:34:09 +0000 |
| Subject: | Re: AW: [PHP] String. If contains | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14408@lists.php.net to get a copy of this message | ||
Hiya
//for chars:
if (is_int(str_pos($string, $find))) {
/* do when found */} //for strings: if (strstr($string, $find)) {
/* do when found */} Greetz, Wico At 14:45 30-8-00 +0200, Jochen Kächelin wrote:
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 thevalue "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 -- 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