note 23970 deleted from function.strstr by dams
| From: | dams@php.net | Date: | Sat, 03 Aug 2002 15:56:29 +0000 |
| Subject: | note 23970 deleted from function.strstr by dams | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-34205@lists.php.net to get a copy of this message | ||
This is weird. How can a programmer use strstr() for checking whether needle is in the haystack. Use
strpos().
if (strpos('I Love PHP', 'I Love')!===FALSE){ //found
}
Look at !== this helps you to differentiate between 0 and FALSE returned.