Condicionales en php
Este post se publicó hace más de dos años, es posible que la información publicada esté obsoleta o las referencias no existan.
La sintaxis es ligeramente diferente si queremos intercalar html entre los condicionales, la ventaja es que la lectura del código es más simple.
Alternando html
<?php if($content_type === '') { ?>
<p>No hay contenido</p>
<?php } else { ?>
<p>Si hay contenido</p>
<?php } ?>
Php
<?php
if($content_type === ''){
echo 'Nop';
} else {
echo 'Sip';
}
Método abreviado
<?php
$target_blank = true
echo $target_blank ? "target='_blank'" : null;
?>