Display array values in PHP

There is foreach loop in php. You have to traverse the array.

foreach($array as $key => $value)
{
  echo $key." has the value". $value;
}

If you simply want to add commas between values, consider using implode

$string=implode(",",$array);
echo $string;

Leave a Comment