Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22749 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19498 invoked by uid 1010); 14 Apr 2006 03:54:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 19480 invoked from network); 14 Apr 2006 03:54:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Apr 2006 03:54:33 -0000 X-Host-Fingerprint: 192.38.9.232 gw2.emini.dk Linux 2.4/2.6 Received: from ([192.38.9.232:9966] helo=gw2.emini.dk) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E3/9C-19715-8FC1F344 for ; Thu, 13 Apr 2006 23:54:33 -0400 Received: from [10.0.0.11] (gw1.emini.dk [212.242.124.121]) by gw2.emini.dk (Postfix) with ESMTP id DD3B3ACAA0; Fri, 14 Apr 2006 05:54:28 +0200 (CEST) Message-ID: <443F1D00.6060806@emini.dk> Date: Fri, 14 Apr 2006 05:54:40 +0200 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: ceo@l-i-e.com Cc: internals@lists.php.net References: <47939.67.108.68.36.1144986573.squirrel@www.l-i-e.com> In-Reply-To: <47939.67.108.68.36.1144986573.squirrel@www.l-i-e.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] CLI php -r requires final ; From: edink@emini.dk (Edin Kadribasic) php -r is equivalent of calling eval() in php code. See http://php.net/eval for details. Edin Richard Lynch wrote: > 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 > 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 > > 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 for me, in my mind, at least. > > I just sort of expected that the -r getting rid of 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. >