Using implode() and explode() in PHP


Convert arrays to strings and vice versa with implode() and explode().

Source Code

$array = ['apple', 'banana', 'cherry'];
$string = implode(", ", $array); // Converts array to string
$newArray = explode(", ", $string); // Converts string back to array
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments