PHP strspn() Function

PHP strrpos() Function
PHP strstr() Function

what is the syntax of the STRSPN() function in php?

strspn(string,charlist,start,length)
ParameterDescription
stringRequired. Specifies the string to search
charlistRequired. Specifies the characters to find
startOptional. Specifies where in the string to start
lengthOptional. Defines the length of the string
PHP STRSPN() method

examples of the STRSPN() function

Example 1. In this example, we return the number of characters found in the string “Hello world!” that contains the characters “kHlleo”.

<?php
echo strspn("Hello world!","kHlleo");
?>

Example 2. In this example, we return the number of characters found in the string “abcdefand” that contains the characters “abc”.

<?php
echo strspn("abcdefand","abc");
?>
PHP strrpos() Function
PHP strstr() Function

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top