You'll need to set an additional variable in the loop after each value is printed, say "$lastvalue".
Then, early in the loop, check to see if the value you are about to print is equal to the $lastvalue variable; if it's not, print the seperator ....
$foo=array(1,1,1,2,3,4,4,5,6);
foreach ($foo as $f) {
if ($f!=$lastvalue) {
echo "----- \n";
}
echo $f. "\n";
$lastvalue=$f;
}