In this tutorial we’re going to learn how to use substr_count function in php with example.
1step create below file
index.php
And put below code
<?php
$string = "this is cotocus pvt ltd";
$getting_array = array(
't'=>substr_count($string,'t')
);
foreach($getting_array as $count =>$data){
echo"$count - $data\n";
}
?>
Output:-
![](https://www.devopsfreelancer.com/blog/wp-content/uploads/2024/03/image-72.png)