- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
$string=$_GET['textarea'];
$Words = explode(" ", $string);
$Freq = array();
for($i=0; $i<20; $i++)
{$Freq[] = 0;
}
foreach($Words as $k=>$v)
{
$length = strlen($v);
$strlength = intval($length);
$Freq[$strlength] += 1;
}
foreach($Freq as $k=>$v)
{if ($v > 0)
echo "Number of words with $k letters: $v <br>";
}
$length = strlen($v);
$strlength = intval($length);