Home  >  Article  >  Backend Development  >  strspn() function in PHP

strspn() function in PHP

王林
王林forward
2023-08-26 12:57:031108browse

strspn() function in PHP

strspn() function returns the number of characters found in the string of the charlist parameter.

Syntax

strspn(str,charlist,begin,len)

Parameters

  • str - The string to search for

  • charlist - The character to find

  • start - Where to start in the string

  • len - The length of the string

Returns

strspn() function returns the number of characters found in the string of the charlist parameter. If the string is not found, returns false.

Example

The following is an example -

Real-time demonstration

<?php
   echo strspn("mobilephone","o");
?>

Output

The following is the output -

0

The above is the detailed content of strspn() function in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete