Pues, puedes hacerlo con funciones como dice el Compi, o puedes usar una variable que te diga si usar 1 u otro codigo:
Código PHP:
$ejecutarPrimero = true ;
if ($ejecutarPrimero == true)
{
if ($f_intentos == 0){
if($resumen=="Aprobo Examen Teorico")
(($f_codest="T") and ($f_intentos = "1"));
else if($resumen=="Reprobo Examen Teorico")
(($f_codest="E") and ($f_intentos="1"));
echo "Ramo 1";
}
}
else
{
if ($f_intentos == 1){
if($resumen=="Aprobo Examen Teorico")
(($f_codest="T") and ($f_intentos="2"));
else if($resumen=="Reprobo Examen Teorico")
(($f_codest="E") and ($f_intentos="2"));
echo "Ramo 2";
}
}