title: Foreach loop shows only the last row
body: <p>I created an email placeholder (#_DATATABEL) for the plugin Events Manager. This placeholder must show the repeater fields from customized fields from Advanced Custom Fields Pro.</p>
  <p>In this case, the loop shows only the last row. There are four rows/results in total.</p>
  <p>How can I fix this?</p>
  <pre><code>&lt;?php
      //
      // Create new placeholder | events manager email
      //
      add_filter('em_event_output_placeholder', 'datatable_placeholders', 1, 3);
      function datatable_placeholders($replace, $EM_Event, $result) {
          if($result == '#_DATATABEL') {
              $current_event_id = $EM_Event-&gt;output(&quot;#_EVENTPOSTID&quot;);
              $replace = 'none';
              //$EM_Event = new EM_Event($cursus_id);
  
              $replace = create_data_table_mail($current_event_id);
          }
          return $replace;
      }
  
      function create_data_table_mail($current_event_id) {
          if(get_field('gekoppelde_cursus_leergang', $current_event_id)) {
  
              $loop = get_field('gekoppelde_cursus_leergang', $current_event_id);
              foreach($loop as $sub_field) {
                  $resultaat = $sub_field['cursus_leergang'];
              }
          }
          return $resultaat;
      }
  ?&gt;
  </code></pre>