PHP strcspn() Function

PHP strcoll() Function
PHP strip_tags() Function

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

strcspn(string,char,start,length)
ParameterDescription
stringRequired. Specifies the string to search
charRequired. Specifies the characters to search for
startOptional. Specifies where in string to start
lengthOptional. Specifies the length of the string (how much of the string to search)
PHP STRCSPN() method

examples of the STRCSPN() function in php

Example 1. In this example, we print the number of characters found in “Hello world!” before the character “w”.

<?php
echo strcspn("Hello world!","w");
?>

Example 2. In this example, we use all parameters to print the number of characters found in “Hello world!” before the character “w”.

<?php
echo strcspn("Hello world!","w",0,6); // The start position is 0 and the length of the search string is 6.
?>
PHP strcoll() Function
PHP strip_tags() Function
en English
X
Scroll to Top