Using implode() to Join Array Elements with a String in PHP


Convert an array to a string by joining its elements with a glue string.

Source Code

$array = ['lastname', 'email', 'phone'];
$comma_separated = implode(",", $array);
echo $comma_separated; // lastname,email,phone
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments