note 86875 deleted from control-structures.alternative-syntax by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 12:18:27 +0000 |
| Subject: | note 86875 deleted from control-structures.alternative-syntax by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197166@lists.php.net to get a copy of this message | ||
Note Submitter: mido_alone2001 at yahoo dot com
----
Hello , when you going to make a script , you must try easist way to do and fastest way to parse ..
using alternative-syntax is very useful to shorten your code
e.g :
If you want to do:
<?php
$a=1 ;
if ($a==1) {
echo "<table border=1><tr><td>$a is equal to one
</td></tr></table> " ;
}
?>
You can do it using alternative-syntax as following :
<?php
$a=1 ;
if ($a==1) :?>
<table border=1><tr><td><?echo $a ;?> is equal to one
</td></tr></table>
<?php endif ; ?>
So the HTML code Won't excuted until the condition is true
[EDIT BY danbrown AT php DOT net: Contains a bug fix provided by (gmdebby AT gmail DOT com).]