note 94998 deleted from function.count-chars by danbrown

From: Date: Mon, 07 Dec 2009 21:00:59 +0000
Subject: note 94998 deleted from function.count-chars by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-163680@lists.php.net to get a copy of this message
Note Submitter: german at spellman dot com dot ar ---- 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!

« previous php.notes (#163680) next »