• PHP Video Tutorials

PHP - Function Strcspn



Syntax

strcspn(string,char,start,length)

Definition and Usage

It returns number of characters find in a string before any part of the specified characters are found.

Return Values

It returns number of characters found in a string

Parameters

Sr.No Parameters & Description
1

string

It specifies string to search

2

char

It specifies chars to search

3

start

It specifies where in string to start

4

length

It specifies the length of a string

Example

Try out the following example

<?php
   echo strcspn("tutorialspoint simply easy learning","r");
?>

This will produce following result −

4
php_function_reference.htm
Advertisements