ID: 18705 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: All PHP Version: 4.2.2 New Comment:
This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2002-08-03 06:38:51] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ [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