str_word_count() 函数计算字符串中的单词数.
语法:str_word_count(string,return,char)
参数 描述
string 必需,规定要检查的字符串.
return 可选,规定 str_word_count() 函数的返回值.
可能的值:0 - 默认,返回找到的单词的数目,1 - 返回包含字符串中的单词的数组,2 - 返回一个数组,其中的键是单词在字符串中的位置,值是实际的单词.
return 可选,规定被认定为单词的特殊字符,该参数是 php 5.1 中新加的,代码如下:
$str="hello world"; //定义字符串 $result=str_word_count($str); //查找单词个数 echo $result; //输出的结果 echo "<br>"; $result=str_word_count($str,1); //返回数组 print_r($result); //输出结果数组
文章网址:
随意转载^^但请附上教程地址。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.