forked from hanlintao/translatorscanprogram
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path代码 7-4.php
More file actions
25 lines (25 loc) · 869 Bytes
/
代码 7-4.php
File metadata and controls
25 lines (25 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php include "shared/head.php"; ?>
<form action="" method="POST">
<table>
<tr>
<td><textarea rows="10" name ="text">北京语言大学(Beijing Language and Culture University, BLCU)成立于1962年。</textarea></td>
</tr>
<tr>
<td><button type="submit">开始统计</button></td>
</tr>
</table>
</form>
<?php
$text=$_POST["text"];
echo "英文单词个数为:".str_word_count($text)."<br>";
echo "英文单词包括:";
$english_char_num="";
foreach(str_word_count($text,1) as $english)
{
$english_char_num = $english_char_num + strlen($english);
echo $english." ";
}
echo "<br>"."英文单词字符总数为:".$english_char_num."<br>";
echo "全文空格个数为:".substr_count($text," ")."<br>";
?>
<?php include "shared/foot.php"; ?>