• PHP Video Tutorials

PHP - Function substr_count



Syntax

substr_count(string,substring,start,length)

Definition and Usage

It used to count the number of sub strings

Return Values

It returns the number of times the string occurs in a string

Parameters

Sr.No Parameters & Description
1

string

It is used to specifies string to check

2

substring

It is used to specifies the string searching for

3

start

It specifies when in string to start searching

4

length

It specifies length of a string

Example

Try out the following example

<?php
   echo substr_count("sairamkrishna","krishna");
?>

This will produce following result −

1
php_function_reference.htm
Advertisements