This is an alternative syntax for control structures .
So,
if(condition):
else:
endif;
equivalently
if(condition) {
} else {
}
This can come in handy when working with HTML. Imho, it’s easier to read because you don’t have to look for curly braces {}, and the PHP code and HTML don't mix. Example:
<?php if(somehting): ?>
<span>Foo</span>
<?php else: ?>
<span>Bar</span>
<?php endif; ?>
I would not use alternative syntax in the "normal" PHP code, though, since curly braces provide better readability.
source
share