i have a array and how can i cover it to string fastest ?
Array
(
[1] => 1,
[2] => 8,
[3] => 10,
[4] => 16,
)
I need cover it to this string $var = (1,8,10,16)
you can use simple implode function for that .
$arr = array(
"1" => 1,
"2" => 8,
"3" => 10,
"4" => 16
);
echo implode($arr, ",");
output : 1,8,10,16
OR
foreach ($arr as $value) {
echo $value .", ";
}
Output : 1, 8, 10, 16,