Joining Array Elements into a String in PHP


Create a string from array elements using implode().

Source Code

$array = ["one", "two", "three"];
$string = implode(", ", $array);
echo $string; // Outputs: "one, two, three"
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments