PHP strspn() Function

P
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

Add comment

Tutor Network

Share this

Learn PHP from A to Z