Home  >  Article  >  Backend Development  >  strspn function example tutorial_PHP tutorial

strspn function example tutorial_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:00:19917browse

Definition and usage
The strspn() function returns the number of characters found in the string containing only characters from the charlist.

Grammar

strspn(string,charlist,start,length)


Parameters

Description

string: required. Specify string search

charlist:request. The specified character is found

start: optional. Where the specified string starts

length: optional. String prompts and instructions of specified length Note: This feature is binary safe.

Example 1

echo strspn("Hello world!","kHlleo");


?>

The result is: 5

Let’s look at another strspn tutorial.


echo strspn("abcdefand","abc");


?>

The result is 3


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445512.htmlTechArticleDefinition and Usage The strspn() function returns the number of characters found in the string containing only characters from the charlist. Syntax strspn(string,charlist,start,length) Parameter Description string: required. Refers to...
Statement:
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