如何使用php排除数组中的最后一行

I've been trying to read up on this in the manual, but basically I've got an array where I'm trying to reverse it and exclude the last item. So I got 14 items currently in my array and I'm getting it to reverse and it shows 14-2. My code got it to exclude the last item. So I guess it technically works, but I actually want it to output as 13-1. I tried using array_pop and array_shift but I didn't know how to integrate it with array_reverse.

function smile_gallery( $atts ) {
    if( have_rows('smile_gallery', 3045) ):

    $i = 1;

    $html_out = '';

    $html_out .= '<div class="smile-container">';
        $html_out .= '<div class="fg-row row">';

            // vars
            $rows = get_field('smile_gallery', 3045);
            $count = count( get_field('smile_gallery', 3045) );

            $html_out .= '<div class="col-md-8">'; // col-md-offset-1
                $html_out .= '<div class="smile-thumbs">';

                foreach( array_reverse($rows) as $row) :

                // vars
                $week = "smile_week";
                $img = "smile_img";
                $caption = "smile_caption";

                // Do stuff with each post here
                if( $i < $count) :

                    $html_out .= '<div class="smile-thumb-container">';
                        $html_out .= '><h6>Week ' . $row["smile_week"] . '</h6></a>'; // smile thumb week  
                    $html_out .= '</div>'; // smile thumb container
                endif;

                $i++;

                endforeach;

                $html_out .= '</div>';
            $html_out .= '</div>';
        $html_out .= '</div>';
    $html_out .= '</div>'; // smile container

    endif;

    return $html_out;
}
add_shortcode( 'show_smiles', 'smile_gallery' );

I'm reading your question as the following, correct me if I'm wrong.

I've got an array where I'm trying to reverse it and exclude the first and last items.

To do that as you know you're want to use array_pop() and array_shift().

<?php
//
$rows = get_field('smile_gallery', 3045);
$count = count($rows);

array_pop($rows);
array_shift($rows);

foreach (array_reverse($rows) as $row):
...

If you want to reverse first and then do your operations, which is not required if your removing items from both ends. Take out array_reverse from the foreach and then do your manipulations.

<?php
// vars
$rows = get_field('smile_gallery', 3045);
$count = count($rows);

$rows = array_reverse($rows);

array_pop($rows);
array_shift($rows);

foreach ($rows as $row):
...

Let me know if that helps.