note 58425 rejected from function.strstr by betz
| From: | betz@php.net | Date: | Sat, 12 Nov 2005 08:31:38 +0000 |
| Subject: | note 58425 rejected from function.strstr by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-98456@lists.php.net to get a copy of this message | ||
Note Submitter: bmack at kirix dot com
----
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.