I took a look at the wordpress code today, and there are some rare php alternative syntaxes in it,
<?php else : ?> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'thebox' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'thebox' ), 'after' => '</div>' ) ); ?> </div><!-- .entry-content --> <?php endif; ?>
Colon (:) is equivalent to the left curly bracket ({), endif is equivalent to the right curly bracket (});
Let’s give an example:
It’s a negative number
The above statement is equivalent to
It’s a negative number
What are the alternative syntaxes in PHP?
There are alternative syntaxes for flow control (including if, while, forforeach, switch) statements.
Basic form of alternative syntax:
Replace the left curly brace ({) with a colon (:), and replace the right curly brace (}) with endif;, endwhile;, endfor;, endforeach; and endswitch;
while alternative syntax:
Other alternative syntaxes can be derived by analogy.