- print_r: documentation ( source)
- end: documentation ( source)
- array_shift: documentation ( source)
<?php
$array = array('Jay', 'Jay', 'Jay', 'Spiders', 'Dogs', 'Cats', 'John', 'John', 'John', 'Dogs', 'Cows', 'Snakes');
$new = array( array_shift( $array));
foreach( $array as $el) {
if( !($new[count($new) - 1] === $el)) {
$new[] = $el;
}
}
print_r( $new);
end( $new);
foreach( $new as $el) { echo $el , "\n";
}