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