Answers for "seperate a string using comma php"

PHP
6

array to string separated by comma php

$arr = array ( 0 => "lorem", 1 => "ipsum", 2 => "dolor");

$str = implode (", ", $arr);
Posted by: Guest on September-22-2020
0

in loop how add string by comma in php

//join string values by comma in loop
$string = '';

foreach ($array as $key => $value) {
    $string .= ",$value";
}

$string = substr($string, 1); // remove leading ","
//@sujay
Posted by: Guest on October-27-2020

Code answers related to "seperate a string using comma php"

Browse Popular Code Answers by Language