It might be worthwhile noting that the array supplied to implode() can contain objects, provided the objects implement the __toString() method.
Example:
<?php
class Foo
{
protected $title;
public function __construct($title)
{
$this->title = $title;
}
public function __toString()
{
return $this->title;
}
}
$array = [
new Foo('foo'),
new Foo('bar'),
new Foo('qux')
];
echo implode('; ', $array);
?>
will output:
foo; bar; qux