Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • String Function In PHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 117
    Comment on it

    String function in php

    To reverse a string

    strrev- It is used to reverse a string.

    <?php
    echo strrev("Hello world!"); // outputs !dlrow olleH
    ?> 
    

    To search for a specific text in your string

    strpos- it return the character position of the text if true else return false

    <?php
    echo strpos("Hello world!", "world"); // outputs 6
    ?>
    

    To replace a text

    str_replace- To replace a text.

    <?php
    echo str_replace("world", "Dolly", "Hello world!"); // outputs Hello Dolly!
    ?>
    

 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: