This article will provide example of php implode function. let’s discuss about php implode string to array. you will learn php split string to array using implode. you’ll learn implode function in php example. You Can Learn How to fetch this week records in MySql
The PHP implode() function breaks an array into a string. explode() takes a two arguments separator and array. You Can Also Learn How to Convert an Array into Object in Laravel
Let’s see below PHP implode() Function Example:
Syntax:
implode(separator,array)
Example 1:
index.php
<?php
$users = ["Hardik", "Vimal", "Harshad", "Paresh"];
$string = implode(', ', $users);
print_r($array);
Output:
Hardik, Vimal, Harshad, Paresh
Example 2:
index.php
<?php
$myArray = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
$string = implode(',', $myArray);
print_r($array);
Output:
0,1,2,3,4,5,6,7,8,9
I hope it can help you…