$colors = ['red', 'green', 'blue'];
$comma_separated = implode(', ', $colors);

echo $comma_separated; // 출력: 'red, green, blue'
implode(string $separator, array $array): string
$fruits = ['apple', 'banana', 'orange'];
$fruits_string = implode(', ', $fruits);

echo $fruits_string; // 출력: apple, banana, orange
$items = ['Item 1', 'Item 2', 'Item 3'];
$html_list = '<ul><li>' . implode('</li><li>', $items) . '</li></ul>';

echo "HTML List:\n" . $html_list;
결과 출력
class StringArray {
    protected $title;

    public function __construct($title)
    {
        $this->title = $title;
    }

    public function __toString()
    {
        return $this->title;
    }
}

$array = [
    new StringArray('봄'),
    new StringArray('여름'),
    new StringArray('가을'),
	new StringArray('겨울')
];

echo implode('; ', $array); // 출력: '봄; 여름; 가을; 겨울'
$booleans_array = [true, true, false, false, true];
$result = implode('', $booleans_array);

var_dump($result); // 출력: string(3) '111'
// true는 '1'이 되고, false는 아무것도 되지 않습니다.