ID: 18705 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Feedback +Status: Open Bug Type: Documentation problem Operating System: All PHP Version: 4.2.2 New Comment:
Attention : Keep in mind that when you want whether there is substring into string it is better to use strpos() than to use strstr(). Most times users has problems to differentiate the cases where the substring is found at position 0 and in the case where it is not found. Example 2: $needle = "I love"; $haystack = "I love PHP!"; //using strstr() - bad - exhaust of memory and cpu if (strstr($haystack, $needle)){ // found } //using strpos() - good no exhaust of memory if (strpos($haystack, $needle) === TRUE){ // found } -=-=-=-=-= End of example. Previous Comments: ------------------------------------------------------------------------ [2002-08-02 11:43:56] [EMAIL PROTECTED] Feel free to write the part you would like to see, submit it to this bug, and it will hopefully (probably) be added to the documentation. ------------------------------------------------------------------------ [2002-08-02 09:00:23] [EMAIL PROTECTED] Is it possible more information to be added to the docs of strstr() that it is better to look if there is needle in a haystack by using strpos() - in bold. Even small example. Regards, Andrey Hristov ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18705&edit=1 -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php