Count within foreach loop

Insert a new $counter variable before the foreach loop starts, and at the very end of the loop, call $counter++ to increment the number. In the middle, just echo out the $counter variable.

<?php 
$pages = get_children(array('orderby' => 'menu_order', 'order' => 'asc'));
// Add a counter before foreach starts
$counter = 1;
foreach($pages as $post) {
setup_postdata($post);
$fields = get_fields();
?>



<div class="menu-button-<?php echo $counter; /* echo out counter */ ?>">
        <a href="https://wordpress.stackexchange.com/questions/27271/<?php echo get_page_link( $post->ID ); ?>"><?php echo $post->post_title; ?></a>
    </div>
<?php
$counter++; // increment before foreach ends
}
wp_reset_query();
?>