note 40295 deleted from control-structures.alternative-syntax by betz

From: Date: Thu, 31 Mar 2005 12:01:37 +0000
Subject: note 40295 deleted from control-structures.alternative-syntax by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-87263@lists.php.net to get a copy of this message
Note Submitter: archangelq at NOSPAM archangelq dot net ---- I would also like to point out that there is a very cool way to use this alternate syntax in the actual html that is to be displayed and printed out. Example: <?PHP if($foo): ?> <p>Foo is correct <?PHP else: ?> <p>Foo is false <?PHP endif; ?> Obviously, this has more uses, but the cool part about this is you use conditionals to output preformated html, rather than having to rely on things like here documents and such that look rather crufty to designers, and that they might screw up. It also allows easy addition of additional possiblilities for output without having to screw with embeded <?PHP echo $bar ?> statements and the like. Or try this one. <table> <tr> <?PHP foreach($tableheaderslist as $tableheadername): ?> <th><?PHP echo $tableheadername ?> <?PHP endforeach; ?> </tr> <?PHP foreach($tablerows as $row): ?> <tr> <?PHP foreach($row as $data): ?> <td>$data</td> <?PHP endforeach; ?> <tr> <?PHP endforeach; ?> </table> Easy tabular output of all of the data from a database request anyone?

« previous php.notes (#87263) next »