Implode and Explode in PHP
Implode and Explode in PHP

Implode and Explode in PHP there usage

Implode, Explode are commonly used functions in PHP. Implode is used to convert array values to a string. While passing parameter we can replace coma(,) by anything like space




echo implode(' ',$my_array);

The output of this example will be

My self Junaid

In the above example, we can see that all comas are replaced by space. we can use this function to a multi-selection option like a checkbox

Explode will help us to convert a string to an array using any separator. explode will help us to separate each value from a string to array value




$my_string="My self Junaid";
print_r (explode(" ",$my_string));


Array ( [0] => My [1] => self [2] => Junaid ) 

in the case of Explode, we can set a limit as the third parameter.

These two functions will help us when varus type of form action takes place for example


The output will be $age1 value will be 18 and $age2 value will be 22.

About the author

Junaid V J

My self Junaid . This Blog is a platform to gain immense knowledge of web development. Modern web designing and development can be acquired through this. Specialized in HTML, PHP, CSS, JAVASCRIPT , BOOTSTRAP,WORDPRESS, CODEIGNITER.

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *