<p>
<?php$data = file_get_contents('http://app.uladech.edu.pe/?param1=planestudioscurricula¶m2=02¶m3=22');
$valores = json_decode($data);
$i = 0;
$ciclo = '';
echo '
<table class="table-planes table-striped" ><tbody>
';
foreach ($valores as $valor) {$temp = $valor->ciclo;
if ($i = 0) {
$ciclo = $valor->ciclo;
echo '<tr><th colspan="5" class="title-ciclo">Ciclo ' . $valor->ciclo . '</th></tr>';
echo '
<tr>
<th class="text-center">Curso</th>
<th class="text-left">Nombre del Curso</th>
<th class="text-center">Creditos</th>
</tr>
<tr>
<td class="text-center">'.$valor->curso.'</td>
<td class="text-left">'.$valor->nombre.'</td>
<td class="text-center">'.$valor->nrocreditos.'</td>
</tr>
';
} else {
if ($ciclo == $temp) {
echo '
<tr>
<td class="text-center">'.$valor->curso.'</td>
<td class="text-left">'.$valor->nombre.'</td>
<td class="text-center">'.$valor->nrocreditos.'</td>
</tr>
';
}else{
$ciclo = $valor->ciclo;
echo '<tr><th colspan="5" class="title-ciclo">Ciclo ' . $valor->ciclo . '</th></tr>';
echo '
<tr>
<th class="text-center">Curso</th>
<th class="text-left">Nombre del Curso</th>
<th class="text-center">Creditos</th>
</tr>
<tr>
<td class="text-center">'.$valor->curso.'</td>
<td class="text-left">'.$valor->nombre.'</td>
<td class="text-center">'.$valor->nrocreditos.'</td>
</tr>
';
}
}
$i++;
}
echo '</tbody>
</table>
';
?>
</p>