FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Comments legal? For loop legal?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Comments legal? For loop legal? [message #170524 is a reply to message #170521] Fri, 05 November 2010 22:28 Go to previous messageGo to previous message
Brian Smither is currently offline  Brian Smither
Messages: 5
Registered: October 2010
Karma:
Junior Member
Brian Smither <ignore(at)ignore(dot)com> wrote in
news:Xns9E27A0232C8FFbhsmithergmailcom(at)216(dot)151(dot)153(dot)39:

> // Digital Product : BEGIN
>
> Would a colon ever constitute a beginning or ending of a script block?

This is my theory...

There is such a concept as script blocks and control blocks.

Knowing that single line comments terminate at the end of the line OR at
the end of the script block, whichever comes first. (A lot of articles
around the web neglect to mention that part.) So...

<?php
echo "Line 1";
// echo "Line 2"; ?>
die("Last Line");
<?php
echo "Line 3"; ?>

....will NOT kill the script as anticipated.

There is such a concept as an Alternative Control Structure (ACS)
syntax. Example:

if(expression):
elseif:
else:
endif;

The theory...

The ACS is acted upon in single-line comments.

Example:

if(expression):
// COMMENT : endif
else:
end; // maybe 'end' by itself is legal?

Possible result: Unexpected T_ELSE error.

NOTES:
1. Intentionally mixing structure styles can lead to unpredicable
results.
2. Inadvertently mixing structure styles, even innocuous characters in
comments, can lead to unpredicable results.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: There is some framework/tool to generate PHP code
Next Topic: urls in php
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 18:11:56 GMT 2024

Total time taken to generate the page: 0.03853 seconds