'
' . __( 'Pages:', 'thebox' ), 'after' => '< /div>' ) ); ?>
What do the colon and endif after else mean? I'm a newbie, I haven't seen it before, so I googled it and realized that this is an alternative syntax for PHP,
Colon (:) is equivalent to the left curly bracket ({), endif is equivalent to the right curly bracket (});
Give me an example:
Copy code The code is as follows:
It’s a negative number
Copy code The code is as follows:
The above statement is equivalent to
Copy code The code is as follows:
It’s a negative number
Copy code The code is as follows:
Flow control (including if, while, forforeach, switch) statements have alternative syntax.
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:
Copy code The code is as follows:
Other alternative syntaxes can be derived by analogy.
http://www.bkjia.com/PHPjc/940494.html