probably your end function return 5 (5 rows)
but row 5 use _4_(beause rows start with _0_)
you dont need this line to get subfields: $rows = get_post_meta( 348, 'testimonials', false ); // get all the rows
but what is inside $rows?
if it is the row-count, or you could get it from it.
than use $rows--; after and you have the number you can use for the last row
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users