$test = get_field(‘testing’, $post->ID);
$last_row = end($test);
causes
PHP Warning: end() expects parameter 1 to be array, bool given in url/test.php on line 678
PHP Notice: Trying to access array offset on value of type null in url/test.php on line 685
PHP Notice: Trying to access array offset on value of type null in url/test.php on line 686
How to fix that?
You need to test to make sure the field returns an array before using end(). If the field has no value it will return NULL.
if (is_array($test)) {
// do stuff with the array
}