Introduction to alternative syntax in PHP and introduction to alternative syntax in PHP. Introduction to alternative syntax in PHP. Introduction to alternative syntax in PHP today I checked the wordpress code, which contains some rare Alternative php syntax. the copied code is as follows: Introduction to alternative syntax in phpelse: divclass PHP, PHP alternative syntax
Today I read the wordpress code, which contains some rare Alternative php syntax,
The code is as follows:
<? Php else:?>
<? Php the_content (_ ('continue reading → ', 'thebox');?>
<? Php wp_link_pages (array ('before' =>'
'. _ ('Pages:', 'thebox'), 'after' =>'
');?>
<? Php endif;?>
What do the colons and endif after else represent? I have never met a Cainiao, so I just googled it to understand that this is an alternative syntax for php,
Colon (:) is equivalent to Left curly braces ({), and endif is equivalent to right curly braces (});
For example:
The code is as follows:
<? Php if ($ a <0):?>
Is a negative number.
The code is as follows:
<? Php endif;?>
The preceding statement is equivalent
The code is as follows:
<? Php if ($ a <0) {?>
Is a negative number.
The code is as follows:
<? Php }?>
Which of the following statements in PHP have alternative syntaxes?
Process control (including if, while, forforeach, switch) statements have alternative syntax.
The basic form of alternative syntax:
Replace Left curly braces ({) with colons (:), and change right curly braces (}) with endif;, endwhile;, endfor;, endforeach; and endswitch;
While alternative syntax:
The code is as follows:
<? Php while (expr):?>
Loop point
<? Php endwhile;?>
Other alternative syntaxes can be similar.
Today, I checked the wordpress code, which contains some rare Alternative php syntax. the code is as follows: php else: p class = "...