note 103984 added to function.stristr
| From: | hutch120 at osu1 dot php dot net | Date: | Mon, 16 May 2011 01:11:34 +0000 |
| Subject: | note 103984 added to function.stristr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179741@lists.php.net to get a copy of this message | ||
I think the simple example above could be improved, everytime I need to use this I copy the example,
but then have to look back at the function parameters to work out which is the haystack and which
the needle. If the example variable names were clearer then this would be unnecessary. I think the
code example below would improve the documentation:
$needle = 'the needle';
$haystack = 'look for the needle in a haystack';
if(stristr($haystack, $needle) === FALSE) {
echo 'Could not find the needle.';
}
if(stristr($haystack, $needle) !== FALSE) {
echo 'Found the needle!';
}
----
Server IP: 69.147.83.197
Probable Submitter: 202.161.31.148
----
Manual Page -- http://www.php.net/manual/en/function.stristr.php
Edit -- https://master.php.net/note/edit/103984
Del: integrated -- https://master.php.net/note/delete/103984/integrated
Del: useless -- https://master.php.net/note/delete/103984/useless
Del: bad code -- https://master.php.net/note/delete/103984/bad+code
Del: spam -- https://master.php.net/note/delete/103984/spam
Del: non-english -- https://master.php.net/note/delete/103984/non-english
Del: in docs -- https://master.php.net/note/delete/103984/in+docs
Del: other reasons-- https://master.php.net/note/delete/103984
Reject -- https://master.php.net/note/reject/103984
Search -- https://master.php.net/manage/user-notes.php