I am looking for a php function to count the number of characters in a string.

If the number of characters if over a set limit, I want to do something with it conditionally... sort of like this...

Example, whereas "$alt" contains the info in question and is the string I want to count the number of characters in.

$alt = substr("$Text",0,200);

// I want to do a conditional statement at this point to do something based 
// on if the number of characters is over 200.  

Any help will be appreciated.

Regards.

    What i normally do when i need to find the syntax for a function, i use the these pages: http://www.w3schools.com/php/php_ref_string.asp - (look under references). Then click on the function list that you need, in this case string, and you will get a list with all(?) the string functions and a short description of what they do.

      No point using the reference from w3schools. Use the PHP Manual itself.

        laserlight wrote:

        No point using the reference from w3schools. Use the PHP Manual itself.

        I find the w3schools reference easier to read and navigate. But i use the PHP manual as well, but i usuall start looking at w3schools when i want to check out minor stuff like a function.

          Write a Reply...