だから、私はこのような配列を持っています:
Array
(
[0] => Array
(
[name] => Something
)
[1] => Array
(
[name] => Something else
)
[2] => Array
(
[name] => Something else....
)
)
次のように、値を文字列に内破する簡単な方法はありますか?
echo implode(', ', $array[index]['name']) // result: Something, Something else, Something else...
次のように、ループを使用して値を連結する必要はありません。
foreach ($array as $key => $val) {
$string .= ', ' . $val;
}
$string = substr($string, 0, -2); // Needed to cut of the last ', '