Forum Moderators: coopster

Message Too Old, No Replies

How to count the number of characters in a word

a newbie question

         

stardoc

11:10 am on Nov 4, 2005 (gmt 0)

10+ Year Member



Hi,

This is my first question in this forum, so forgive me if it is too basic and stupid.

I have been trying to figure out how to count the number of alphabets in a word. I searched a lot, but could not get any reference. Does php has any built in function to do that?

I stumbled upon the sizeof() function, but it seems to count the number of words and not alphabets.

Any help will be highly appreciated.

Anyango

11:29 am on Nov 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey!

I wonder if from "alphabets" you mean only "a-z,A-Z", if you mean to findout count of individual characters in a string/word, you can use this.

<?
$a="testword";

echo "Count of Characters is: ".strlen($a);
?>

Leme know if that's ok?

Kami

stardoc

12:57 pm on Nov 4, 2005 (gmt 0)

10+ Year Member



worked like a charm. This was exactly what I was looking for!

Thanks a lot.