note 40617 added to function.strpos

From: Date: Tue, 09 Mar 2004 22:26:46 +0000
Subject: note 40617 added to function.strpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-66513@lists.php.net to get a copy of this message
counting the occurrences of a substring, recursive-style instead of looping. <? function countSubstrs($haystack, $needle) { return (($p = strpos($haystack, $needle)) === false) ? 0 : (1 + countSubstrs(substr($haystack, $p+1), $needle)); } ?> ---- Manual Page -- http://www.php.net/manual/en/function.strpos.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40617 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40617&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40617&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#66513) next »