The next code will generate <tr></tr> on every $product->title

<table>
    <?php foreach ($products as $product) {
            echo '<tr>
                      <td>'.$product->title.'</td>
                  </tr>';
    }?>
</table>

But i wish to create the row after every three posts as creation of above code.

<table>
    <tr>
            <td>$product->title/td>
            <td>$product->title/td>
            <td>$product->title</td>
    </tr>
            <td>$product->title</td>
            <td>$product->title</td>
            <td>$product->title</td>
    </tr>
</table>

I personally use this type a lot, it's devoted to type memory.

<table>
<?php
    $count = 0;  // we gotta count them lines
    foreach ($products as $product)
    {
        if ( ($count % 3) == 0 )  // every 3 lines
        {
            if ($count > 0)  // not at first line
                echo '</tr>';  // close previous row
            echo '<tr>';  // open new row
         }
         ++$count;  // better count this one now.

         echo '<td>'.$product->title.'</td>;
    }
    if ($count > 0) 
        echo '</tr>';  // close last row
?>
</table>
    $i=1;
    <table>
        <?php foreach ($products as $product) {
           if ( $i<= 3 ) {
               if($i==1) {
                 echo '<tr>';
               }    
               echo '<td>'.$product->title.'</td>';
               $i++;
           }
           else {
               echo'</tr>';
               $i=1;
           }
        }?>
    </table>

Possibly something similar to this:

<table>
<?php
   $count = count($products); 
   foreach ($products as $key => $product) {
        // print on first row and third row
        if($key % 3 == 0) {
            echo '<tr>';
        }
        echo '<td>'.$product->title.'</td>';
        // print on third row or on last element
        if((($key + 1) % 3 == 0 && $key > 0) || $key == $count-1) {
            echo '</tr>';
        }
   }
?>
</table>

Should you array is not indexed from or more you would need to make use of a counter for that $key variable.