Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • substr_count() string function in php

    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 126
    Comment on it

    The substr_count() in php is a string function which counts the no of times the sub string occurred in the string.
    this function is case-sensitive.

    the syntax of the function is as :

    substr_count(string,substring,start,length)
    

    Here , the string is the string in which the substring is to be count, substring is a string which is to be find.
    the start is the position from where the search is to be started and the length is to specify the length of the search.

    The function returns the number of times the substring appeared in the function.

    example:

    <?php
           $str = "This is good";
           echo substr_count($str,"is",3,3).";
    ?>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: