The final ; is needed with php -r. It's even documented somewhere :)
----- Original Message ----- From: "Richard Lynch" <[EMAIL PROTECTED]>
To: <internals@lists.php.net> Sent: Friday, April 14, 2006 5:49 AM Subject: [PHP-DEV] CLI php -r requires final ;
This is such minutiae, but I needed a break... The docs say final ?> is not needed, and final ; is not needed: http://php.net/manual/en/language.basic-syntax.instruction-separation.php It does not address what happens if BOTH are missing, however. It would seem that with both missing... -bash-2.05b$ cat temp.php <?php echo 'hello' -bash-2.05b$ php -q temp.php you get a syntax error: Parse error: parse error, unexpected $end, expecting ',' or ';' This is fine, of course. We'll call it a feature, even, I guess. But, for me, it feels decidedly "odd" when I do: php -r "echo 'hello'" and get: Parse error: parse error, unexpected $end, expecting ',' or ';' I mean, for some reason, I just expected that the "optional" semi-colon at the end was, well, optional... I mean, -r runs the code without me needing to add <?php and ?> It's not like I'm relying on the optional ?> at the end of a file feature. It's a different animal. php -r is "adding in" both <?php and ?> for me, in my mind, at least. I just sort of expected that the -r getting rid of <?php and ?> didn't "count" against the ?> OR ; being optional, and I figured the ; was still optional. Am I being too petty? :-^ I'm not filing this as bug report without some feedback, that's for sure! Actually, I'm just interested to see how others think about this. I don't even like leaving off ?> nor ; in PHP source code. I think it's just a sign of sloppy coding -- even if it does mean that I can't get that perfectly-align HTML coming out. -- Like Music? http://l-i-e.com/artists.htm -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php __________ NOD32 1.1380 (20060125) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php