How to Count Number of Character in PHP

Hello Guys This tutorial is all about How to Count Number of Character in PHP. Counting of letters used in a paragraph will help the user detect how many letters he/she typed.
This Tutorial will teach you on how to create an application in php that count the number of character in word and paragraph.

So Let’s get started:

First is to create a class name it “index.php” then add this code:

<!DOCTYPE html>
<html>
<head>

function validateForm()
{
var x=document.forms["myForm"]["fname"].value;
x = x.split(" ").join("");
alert(x.length);
}

</head>

<body>
<form name="myForm" action="#" onsubmit="return validateForm()" method="post">
Insert text to You want to count: <br>
<textarea name="fname" cols="50" rows="4">Text to count</textarea><br>
<input type="submit" value="Submit">
</form>
</body>

</html>

Then your done, Simple as that go and test the program now!

Sample

If you have any comments or suggestions about the How to Count Number of Character in PHP Please message us directly:

Download Source Code Here:

Other Articles you might read also:

Leave a Comment