PHP Implode() Function || PHP Functions
×


PHP Implode() Function

3084

PHP implode() function is used to joining an array with the string like if you want to get the multiple values of array in a string then use the implode function.

<?php
$getdata=array("I", "want", "to", "change", "the", "format", "of", "line.");
$final_string=implode('-', $getdata);
echo $final_string;
?>

Output:

I-want-to-change-the-format-of-line.


implode(separator,array)

Here:

1. separator: is used to put the string with what you want to join. Default string is an empty string (i.e. "")

2. array: is mandatory and used to join to a string.

You can use different types of strings to join

<?php
$getdata=array("I", "want", "to", "change", "the", "format", "of", "line.");
$final_string=implode(',', $getdata);
echo $final_string;
?>

Output:

 I,want,to,change,the,format,of,line.



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments