note 79583 added to function.count-chars
| From: | phpC2007 at osu1 dot php dot net | Date: | Tue, 04 Dec 2007 15:42:21 +0000 |
| Subject: | note 79583 added to function.count-chars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132801@lists.php.net to get a copy of this message | ||
Here's a function to count number of strings in a string. It can be used as a simple
utf8-enabled count_chars (but limited to a single mode)...
<?php
function utf8_count_strings($stringChar)
{
$num = -1;
$lenStringChar = strlen($stringChar);
for ($lastPosition = 0;
$lastPosition !== false;
$lastPosition = strpos($textSnippet, $stringChar, $lastPosition + $lenStringChar))
{
$num++;
}
return $num;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 82.201.219.96
----
Manual Page -- http://www.php.net/manual/en/function.count-chars.php
Edit -- https://master.php.net/note/edit/79583
Del: integrated -- https://master.php.net/note/delete/79583/integrated
Del: useless -- https://master.php.net/note/delete/79583/useless
Del: bad code -- https://master.php.net/note/delete/79583/bad+code
Del: spam -- https://master.php.net/note/delete/79583/spam
Del: non-english -- https://master.php.net/note/delete/79583/non-english
Del: in docs -- https://master.php.net/note/delete/79583/in+docs
Del: other reasons-- https://master.php.net/note/delete/79583
Reject -- https://master.php.net/note/reject/79583
Search -- https://master.php.net/manage/user-notes.php