- implode: documentation ( source)
<?php
function test($a) {
if (!is_array($a) && ! $a instanceof \Traversable) {
throw new \Exception("here");
}
return implode(' ', $a);
}
$traversable = new ArrayObject();
$traversable['test'] = 'that';
echo test(['a', 'b', 'c']);
echo test($traversable);