How to use substr count in PHP

In this article I will explain how substr_count function can be used in PHP.
  • 1708

substr_count() function

This function counts the number of times a substring occurs in a string.

Syntax

substr_count(string,substring,start,length)

Example

<html>
<body>
<?php
echo substr_count("Hello Rock. The Rock is Star","Rock");
?>
</body>
</html>

 

Output


substr-count-php.jpg

You may also want to read these related articles Click here

Ask Your Question

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.