How to separate an array with commas in PHP

Separating an array with commas in PHP, we are separating an array with PHP’s function implode, first we are using an array of sample values and assigning it to an $array variable. then we are passing two arguments to implode function one is separator, what we want to separate the array with, ane the next one the array.

<?php
$array = array('hi', 'this', 'is', 'an', 'array');
$comma_list = implode(', ', $array);
echo $comma_list;
?>

Vivek Vengala
 

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 0 comments

Leave a Reply:

x

Join My Facebook Group to Receive Coding Tutorial for Free

email-subsribe