note 103984 deleted from function.stristr by danbrown

From: Date: Mon, 16 May 2011 16:11:24 +0000
Subject: note 103984 deleted from function.stristr by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179767@lists.php.net to get a copy of this message
Note Submitter: hutch120 ---- 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!'; }

« previous php.notes (#179767) next »