Link to home
Create AccountLog in
Avatar of twittoris
twittoris

asked on

Counting Characters in a cell

I want to set a variable = to the numbers of characters in a cell.
$var=charcount('cell') ?
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

A "cell" is what, exactly?

You probably want strlen()
http://us2.php.net/manual/en/function.strlen.php
ASKER CERTIFIED SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
This is another one of those questions where it would be good for us to see your inputs and your required outputs.  There are just too many ways to interpret what you mean by "cell" and if you apply strlen() to your example instead of "charcount" you will get the number 4.  We sort of already knew that 'cell' has 4 characters, so it does not seem like you would need help programming a solution to that.

Also, in case I have forgotten to recommend it, you might really enjoy this book.  It has excellent examples and a downloadable code library that you can copy from.  It's been in my professional library for several years.  It won't make you a pro, but it is easy to read and will give you some fluency in the most useful of the many thousands of PHP functions.
http://www.sitepoint.com/books/phpmysql4/
strlen() didn't work for you?
Avatar of twittoris
twittoris

ASKER

No actually

 $str = strlen($row['OWNER']);
  echo "STRING LENGTH: ". strlen($str);

this keeps returning a value of 2
OK, please post a new question showing how you get the $row['OWNER'] and we can help you visualize the data.