Topic: colon after if condition
What is this colon after if condition for? I have never met this before.
<?php if ($mod_restore): ?>
You are not logged in. Please login or register.
PunBB Forums → Programming → colon after if condition
What is this colon after if condition for? I have never met this before.
<?php if ($mod_restore): ?>
it is an alternative control structure in php
http://uk2.php.net/manual/en/control-st … syntax.php
It's a waste of bytes though ( endif; ...) and IMO you should stick to the good old curly brackets. most people do and thus it would make your code better readable for the majority.
But that's the good and the bad thing about php: There are always two million ways to do the same thing, so you can do what you please ...
I actually opted for that syntax to increase readability. There are enough curly brackets in e.g. profile.php as it is Nevertheless, it is an outdated paradigm, so I will consider changing it for 1.3.
Shit. I only just learnt how to use it and its obsolete already.
I like those short stuff for small if statements, like setting a variable either of two things ...
i kinda like them for messy stuff in html, since <?php endif; ?> makes alot more sense than <?php } ?>
PunBB Forums → Programming → colon after if condition
Powered by PunBB, supported by Informer Technologies, Inc.