Re[2]: [PHP] Counting number of characters without spaces between them?
| From: | Richard Davey | Date: | Fri, 23 Apr 2004 16:50:31 +0000 |
| Subject: | Re[2]: [PHP] Counting number of characters without spaces between them? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184431@lists.php.net to get a copy of this message | ||
Hello Chris,
Friday, April 23, 2004, 5:41:59 PM, you wrote:
CS> You can explode on a space and loop through the resulting array, checking
CS> strlen() as you go.
In the end I used a regexp to strip out all non alpha-numeric
characters from the string - and then compared the length of this to
what was left. Using it I can tell if there are vastly more
"non-alpha" characters. Seemed to be a bit quicker than looping
through arrays, etc, although it does involve the overhead of the preg
engine I guess.
BTW - Nice piece in Int PHP Mag this month :)
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html