note 92170 deleted from function.strstr by danbrown

From: Date: Mon, 13 Jul 2009 02:25:57 +0000
Subject: note 92170 deleted from function.strstr by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-158217@lists.php.net to get a copy of this message
Note Submitter: maxmike at gmail dot com ---- Because php 4.3 excludes a parameter it is a bad idea to directly call this function if you are writing a library with backwards compatibility. I've written a similar function here, though I have added a parameter to allow for insensitive or sensitive string seeking. NOTE: php 4.3 will also need a stripos function defined or this function will not work (you can find one of several in the manual for stripos) <?php function strstr_common($haystack, $needle, $part = false, $insensitive = false){ $pos = ($insensitive)?stripos($haystack, $needle, 0):strpos($haystack, $needle, 0); if($pos !== false){ if($part){ return substr($haystack, 0, $pos); }else{ return substr($haystack, $pos); } } return false; } ?>

« previous php.notes (#158217) next »