- Forums
- PHP
- PHP Learn How To Count Characters Letters Are In A String Script Function
This Page Contains information about PHP Learn How To Count Characters Letters Are In A String Script Function By wallpaperama in category PHP with 14 Replies. [1004], Last Updated: Sat May 18, 2024
wallpaperama
Sat Feb 03, 2007
14 Comments
10919 Visits
the other day i wanted to limit the amount of characters in a form, instead of relying on the user, i found out how to do this with php. php has a fucntion called strlen($string) that gives you the amount of characters in a string, the string can be letter or numbers in a sentence or paragraph.
so if you want to write a script to check the number of characters a user to your web site has submitted, you can do this with php with the strlen($string); function. with this function you can tell how many characters you have in a string.
the following code will output 12
CODE:
$string="wallpaperama";
$num_char=strlen($string);
echo $num_char;
hope this helps, if you have any other tips, let me know write you comments or reply to this post. thanks.