php 查找字符串中单词个数
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); //输出结果数组
Copy after login
文章网址:
随意转载^^但请附上教程地址。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

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
What's New in Windows 11 KB5054979 & How to Fix Update Issues
3 weeks ago
By DDD
How to fix KB5055523 fails to install in Windows 11?
2 weeks ago
By DDD
InZoi: How To Apply To School And University
3 weeks ago
By DDD
How to fix KB5055518 fails to install in Windows 10?
2 weeks ago
By DDD
Roblox: Dead Rails – How To Summon And Defeat Nikola Tesla
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
