note 58425 added to function.strstr
| From: | bmack at kirix dot com | Date: | Thu, 03 Nov 2005 21:57:10 +0000 |
| Subject: | note 58425 added to function.strstr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-98041@lists.php.net to get a copy of this message | ||
I just found out with the following example, that the second parameter of strstr is only allowed to
be one character, even if the function is called strSTR and the second parameter has to be a string,
it does not work with any string:
Initially I just wanted the last part after "filter_" (of course only if filter_ exists in
that string, otherwise I would have taken substr):
$myString = "filter_nonsense";
echo strstr($myString, 'filter_');
// returns "filter_nonsense";
echo strstr($myString, '_');
// returns "_nonsense";
Therefore I find this function name inappropriate and misleading. Maybe we should have two different
functions (strchr and strstr) instead of a synonym with those two.
----
Manual Page -- http://www.php.net/manual/en/function.strstr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58425
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58425&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58425&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58425&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58425&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58425&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58425&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58425&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58425&report=yes
Search -- http://master.php.net/manage/user-notes.php