note 99713 added to function.strpos

From: Date: Wed, 01 Sep 2010 03:22:08 +0000
Subject: note 99713 added to function.strpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-172225@lists.php.net to get a copy of this message
Here is my simple but useful function for counting the number of occurrences of the needle into the stack function searchOccNum($needle, $stack){ $offset = 0; $found = 0; if(strpos($pm, $open_link) === false) return 0; else{ while(!(strpos($stack, $needle, $offset) === false)){ $found++; $offset = strpos($pm, $open_link, $offset)+1; } return "found: ".$found." times"; } } ---- Server IP: 69.147.83.197 Probable Submitter: 71.174.91.11 ---- Manual Page -- http://www.php.net/manual/en/function.strpos.php Edit -- https://master.php.net/note/edit/99713 Del: integrated -- https://master.php.net/note/delete/99713/integrated Del: useless -- https://master.php.net/note/delete/99713/useless Del: bad code -- https://master.php.net/note/delete/99713/bad+code Del: spam -- https://master.php.net/note/delete/99713/spam Del: non-english -- https://master.php.net/note/delete/99713/non-english Del: in docs -- https://master.php.net/note/delete/99713/in+docs Del: other reasons-- https://master.php.net/note/delete/99713 Reject -- https://master.php.net/note/reject/99713 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172225) next »