note 94998 added to function.count-chars
| From: | german at spellman dot com dot ar | Date: | Mon, 07 Dec 2009 20:54:10 +0000 |
| Subject: | note 94998 added to function.count-chars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163679@lists.php.net to get a copy of this message | ||
Well, seeing this contribution:
apinpratap at gmail dot com
30-Mar-2007 06:54
I've found some errors. So, I modify the code and I'd like to share it with the rest of
us.
<?php
$inputString = "Hi I wanna write this text just for fun and test the code. Remember that you
can write your own text here or read txt files.";
$enter = 0;
$data = strtolower ($inputString);
foreach (count_chars ($data, 1) as $i => $val)
{
if ($enter == 1)
{
$enter = 0;
continue;
}
if (chr ($i) == "\n")
{
echo "There are $val instance(s) of \" Enter \" in the
string.\n<br>";
$enter = 1;
}
else
{
echo "There are $val instance(s) of \"" , chr ($i) , "\" in the
string.\n<br>";
}
}
?>
Now, as you can see the code shows the text and introduce "<br>" between results.
Bye, Let me know when you upload it!
----
Server IP: 190.2.55.64
Probable Submitter: 201.255.19.144
----
Manual Page -- http://www.php.net/manual/en/function.count-chars.php
Edit -- https://master.php.net/note/edit/94998
Del: integrated -- https://master.php.net/note/delete/94998/integrated
Del: useless -- https://master.php.net/note/delete/94998/useless
Del: bad code -- https://master.php.net/note/delete/94998/bad+code
Del: spam -- https://master.php.net/note/delete/94998/spam
Del: non-english -- https://master.php.net/note/delete/94998/non-english
Del: in docs -- https://master.php.net/note/delete/94998/in+docs
Del: other reasons-- https://master.php.net/note/delete/94998
Reject -- https://master.php.net/note/reject/94998
Search -- https://master.php.net/manage/user-notes.php