note 97433 added to function.substr-count

From: Date: Mon, 19 Apr 2010 17:35:37 +0000
Subject: note 97433 added to function.substr-count
Groups: php.notes 
Request: Send a blank email to php-notes+get-168426@lists.php.net to get a copy of this message
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(). ---- Server IP: 213.249.64.162 Probable Submitter: 82.95.146.179 ---- Manual Page -- http://www.php.net/manual/en/function.substr-count.php Edit -- https://master.php.net/note/edit/97433 Del: integrated -- https://master.php.net/note/delete/97433/integrated Del: useless -- https://master.php.net/note/delete/97433/useless Del: bad code -- https://master.php.net/note/delete/97433/bad+code Del: spam -- https://master.php.net/note/delete/97433/spam Del: non-english -- https://master.php.net/note/delete/97433/non-english Del: in docs -- https://master.php.net/note/delete/97433/in+docs Del: other reasons-- https://master.php.net/note/delete/97433 Reject -- https://master.php.net/note/reject/97433 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168426) next »