Answers for "in loop how add string by comma in php"

PHP
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
0

in loop how add string by comma in php

$values = "";

foreach ($stuffs as $stuff) {
    $values != "" && $values .= ",";
    $values .= $stuff;
 }

echo $values;
//@sujay
Posted by: Guest on October-27-2020

Code answers related to "in loop how add string by comma in php"

Browse Popular Code Answers by Language