note 97433 deleted from function.substr-count by danbrown

From: Date: Fri, 10 Dec 2010 17:10:41 +0000
Subject: note 97433 deleted from function.substr-count by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174774@lists.php.net to get a copy of this message
Note Submitter: ferry ---- If your host didn't support this feature you can use this instead: <?PHP function count_find($haystack,$splitby,$start = 0,$end = 0) { if($end = 0) { $end = strlen($haystack); } return(count(explode($splitby,substr($haystack,$start,$end)))); } ?> and so must you use it: <?PHP echo(count_find('this is a short text','is')); ?> The result is exactly as the output of substr_count().

« previous php.notes (#174774) next »