o, i am not a PHP Ultra Pro programmer but I have been using it for a while in my projects… Recently I have accepted to take part in a WordPress Template for Blog project and, looking into WordPress’ documentation found this piece of code:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
I have never seen that ” : ” operator in PHP and would like to know how does that work and how can i use it in my projects… It seems like a time saver for me, so if anybody could help, that would be great!
Also, I can understand that it powers a if statement, than a while inside that if, can’t figure the_post(); though, is that a function?
:
is used for alternative php syntax structures. It used for replacing bracets, more details you can find here:http://php.net/manual/en/control-structures.alternative-syntax.php