You can get the same result like this:
<?php
$html = '<thead>
<tr>
<th>nombre</th>
<th>apellido</th>
<th>marca</th>
<th>matricula</th>
</tr>
</thead>
<tbody>';
if($blogs){
foreach($blogs as $blog){
$html .= '<tr>
<td>' . $blog->nombre . '</td>
<td>' . $blog->apellido . '</td>
<td>' . $blog->marca . '</td>
<td>' . $blog->matricula . '</td>
<td>
<button>editar</button>
<button>eliminar</button>
</td>
</tr>';
}
}
$html .= '</tbody>';
echo $html;
This method is very effective when you have to intermix the two many times, since it saves you from opening and closing the php tag multiple times.