2023-08-26

在PHP中的strspn()函数

在PHP中的strspn()函数

strspn() 函数返回在 charlist 参数的字符串中找到的字符数。

语法

strspn(str,charlist,begin,len)
登录后复制

参数

  • str – 要搜索的字符串

  • < strong>charlist – 要查找的字符

  • 开始 – 在字符串中从哪里开始

  • < li>

    len – 字符串的长度

返回

strspn() 函数返回字符数在 charlist 参数的字符串中找到。如果未找到字符串,则返回 false。

示例

以下是示例 –

 实时演示

<?php
   echo strspn("mobilephone","o");
?>
登录后复制

输出

以下是输出 –

0
登录后复制

以上就是在PHP中的strspn()函数的详细内容,更多请关注php中文网其它相关文章!

https://www.php.cn/faq/597461.html

发表回复

Your email address will not be published. Required fields are marked *