title: Change HTML for odd & even items in a foreach loop
body: <p>My PHP isn't great!
  I have some metaboxes in a wordpress website that displays a column type layout. I can output the metabox content as follows:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php 
   // Group ID
      $columns_values = rwmb_meta( 'columns_solutions' );
      if ( ! empty( $columns_values ) ) : ?&gt;
  
  &lt;section class="columns"&gt;
  
    &lt;?php foreach ( $columns_values as $columns_value ) {
  
           // Grab the image
              $columns_imgs = isset( $columns_value['_rtl_column_solutions_image'] ) ? $columns_value['_rtl_column_solutions_image'] : array();
              foreach ( $columns_imgs as $columns_img ) {
               // Set each image size for the responsive background
                  $column_image_lg = RWMB_Image_Field::file_info( $columns_img, array( 'size' =&gt; 'column-lg' ) );
                  $column_image_md = RWMB_Image_Field::file_info( $columns_img, array( 'size' =&gt; 'column-md' ) );
                  $column_image_sm = RWMB_Image_Field::file_info( $columns_img, array( 'size' =&gt; 'column-sm' ) );
                  $column_image_xs = RWMB_Image_Field::file_info( $columns_img, array( 'size' =&gt; 'column-xs' ) );
              } 
  
              // Grab the title, oversized text and general text
              $column_title = isset( $columns_value['_rtl_columns_title'] ) ? $columns_value['_rtl_columns_title'] : array();
              $column_oversized = isset( $columns_value['_rtl_columns_oversized'] ) ? $columns_value['_rtl_columns_oversized'] : array();
              $column_general_txt = isset( $columns_value['_rtl_columns_general_text'] ) ? $columns_value['_rtl_columns_general_text'] : array();
  
          ?&gt;
    &lt;div class="columns-wrapper"&gt;
      &lt;div class="column"&gt;
        &lt;?php if(!empty($column_title)) { ?&gt;
        &lt;div class="section-title"&gt;
          &lt;h2&gt;
            &lt;?php echo $column_title; ?&gt;
          &lt;/h2&gt;
        &lt;/div&gt;
        &lt;!-- /.section-title --&gt;
        &lt;?php } ?&gt;
  
        &lt;?php if(!empty($column_oversized)) { ?&gt;
        &lt;div class="oversized"&gt;
          &lt;?php echo $column_oversized; ?&gt;
        &lt;/div&gt;
        &lt;!-- /.oversized --&gt;
        &lt;?php } ?&gt;
  
        &lt;?php if(!empty($column_general_txt)) { ?&gt;
        &lt;?php echo wpautop($column_general_txt); ?&gt;
        &lt;?php } ?&gt;
      &lt;/div&gt;
      &lt;!-- /.column --&gt;
  
      &lt;div class="column"&gt;
        &lt;div class="image min-height cover bg-responsive" style="background-image: url(&lt;?php echo LAZY_IMG; ?&gt;);" 
              data-lg="&lt;?php echo $column_image_lg['url']; ?&gt;" 
              data-md="&lt;?php echo $column_image_md['url']; ?&gt;" 
              data-sm="&lt;?php echo $column_image_sm['url']; ?&gt;"
              data-xs="&lt;?php echo $column_image_xs['url']; ?&gt;"&gt;
        &lt;/div&gt;
        &lt;!-- /.image --&gt;
      &lt;/div&gt;
      &lt;!-- /.column --&gt;
    &lt;/div&gt;
    &lt;!-- /.column-wrapper --&gt;
  
    &lt;?php } ?&gt;
  &lt;/section&gt;
  &lt;!-- /.columns --&gt;
  &lt;?php endif; ?&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Output as below:</p>
  
  <p><a href="https://i.stack.imgur.com/di0sg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/di0sg.jpg" alt="enter image description here"></a></p>
  
  <p>This is a clonable meta group, I would like to be able to swap the content and the image (left &amp; right) with each odd and even foreach loop/array.</p>