Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use strpos() function in php ?

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 128
    Comment on it

    What is the strpos() function ?

    The strpos() function searches for a concrete text within a string.

    In other word we can say that strpos() function use for searching position of Text Within a String.

    If text word match will found, then function will return the word position of the first match. When text word will not found, it will return false.

    you can see below example searches for the text word position:

    <?php
    //here call the  strpos() function for searching position
    echo strpos("City Anjar", "Anjar");
     //search "A" posotion
    
    echo strpos("City Anjar", "City");
     //search "j" posotion
    
    ?>
    

    The first text word position in a string is 0 not 1.

    so when you will print "Anjar".

    output will come:

    5

    and when you will print "City".

    output will come:

    0

 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: