Counting number of images from loop

You can get images with foreach loop but first you have to print_r($images) and then get the value of the array something like this $images[‘image’] or $images[‘src’] or $images[‘url’] etc. But first check is there any record where you are getting get_sub_field(‘image’) all images.

<?php if ( $images = get_sub_field('image') ) :
    print_r($images);
    foreach($images as $image) {
?>
    <div class="inner">
        <?php
            echo $image;
        ?>
    </div>
<?php } endif; ?>