Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • implode and explode string functions in php

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 106
    Comment on it

    Implode()

    It is a string function which returns the Join array elements as a string.
    The Implode() returns a string with elements of array arranged in a string in the same order.

    example:

    <?php
            $str = array('Hello','World!','Good','Morning!');
            echo implode(" ",$str);
    ?>
    

    output
    Hello World! Good Morning!

    explode()

    It is a string function which splits a string by string. It breaks a string in an array.
    we can provide a delimiter in the function which tells how to split the string.

    example:

    <?php
        $str = "Hello world! Good Morning!";
         print_r (explode(" ",$str));
    ?>
    

    output

    Array ( [0] =>; Hello [1] =>; world. [2] =>; Good [3] =>; Morrning )

 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: