[clug-progsig] Odd PHP structure

Shawn sgrover at open2space.com
Wed Mar 29 21:25:56 PST 2006


Errr, ignore my last.  It is in the manual - under "Alternative syntax for 
control 
structures" (http://ca3.php.net/manual/en/control-structures.alternative-syntax.php).

Shawn

On Wednesday 29 March 2006 22:23, Shawn wrote:
> I'm working on a custom template for my website, and the sample code has
> the following snippet:
>
>  <?php if ($sidebar_left != ""): ?>
> 	<div id="sidebar-left">
> 		<?php print $sidebar_left ?>
> 	</div>
>  <?php endif; ?>
>
> The logic is crystal clear to me, but the syntax looks odd.  The manual
> says the right way to do a multiline if statement in PHP is like so:
>
> <?php
> if (condition) {
> 	statement;
> 	statement;
> }
> ?>
>
> Now, I can see that the difference is in how the if statement splits up PHP
> script blocks, but I would think the syntax would use braces like this:
>
>  <?php if ($sidebar_left != "") { ?>
> 	<div id="sidebar-left">
> 		<?php print $sidebar_left ?>
> 	</div>
>  <?php } ?>
>
> And apparently this works.
>
> Am I seeing an old style of PHP?  Am I missing something in the
> documentation?
>
> Thanks for any tips.
>
> Shawn
>
>
> _______________________________________________
> clug-progsig mailing list
> clug-progsig at clug.ca
> http://clug.ca/mailman/listinfo/clug-progsig_clug.ca




More information about the clug-progsig mailing list