网络编程 
首页 > 网络编程 > 浏览文章

PHP count_chars()函数讲解

(编辑:jimmy 日期: 2025/11/2 浏览:3 次 )

PHP count_chars() 函数

实例

返回一个字符串,包含所有在 "Hello World!" 中使用过的不同字符(模式 3):

<"Hello World!"; 
echo count_chars($str,3); 
"htmlcode">
count_chars( _string,mode_ )

PHP count_chars()函数讲解

PHP count_chars()函数讲解

实例 1

返回一个字符串,包含所有在 "Hello World!" 中未使用过的字符(模式 4):

<"Hello World!"; 
echo count_chars($str,4); 
"htmlcode">
<"Hello World!"; 
print_r(count_chars($str,1)); 
"htmlcode">
<"PHP is pretty fun!!"; 
$strArray = count_chars($str,1); 
foreach ($strArray as $key=>$value) 
{ 
echo "The character <b>'".chr($key)."'</b> was found $value time(s)<br>"; 
} 
?>

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接

上一篇:PHP crc32()函数讲解
下一篇:PHP让网站移动访问更加友好方法
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。