Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68234 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99797 invoked from network); 20 Jul 2013 01:58:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2013 01:58:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.173 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 209.85.212.173 mail-wi0-f173.google.com Received: from [209.85.212.173] ([209.85.212.173:64954] helo=mail-wi0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/57-13120-CBEE9E15 for ; Fri, 19 Jul 2013 21:58:20 -0400 Received: by mail-wi0-f173.google.com with SMTP id hq4so334042wib.6 for ; Fri, 19 Jul 2013 18:58:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=unc6F7HT+ofU2rt5okCLuEeXIaTSla4+oygqhCR9Pgg=; b=rnmkCwuM6vNd2GQ7/nHq+98gOaEk2LKubcThrqCMCCBgK2FN6qbP20SiZngtIgzt0Q 3CyrTl3SV6B9Q+3cKrm/8LWYR2fGqz6YR8flRCAZpW4XVv771VOa4wFW9HMV3XRcP9o3 4djeOQyTR5Pc0KkidgSOEIWEp5aMS6SnopDVwmqFOg3W3OTXIK3p1fLULJN1xJqK5Odk 2syyLN/nsyq3bbGJz8erIRsZP1p9Zkb3KZMIUSQ8awShvdMnTT7pUEryL5zbtOb6eAtE GNsVFM0g23SJ8PVAIz9OhDYxR0izbFt4h6qVnrVpGDPPBNHO5Hc/enOi9ck8msT4BMpq KGhA== MIME-Version: 1.0 X-Received: by 10.194.22.167 with SMTP id e7mr14124981wjf.68.1374285496885; Fri, 19 Jul 2013 18:58:16 -0700 (PDT) Received: by 10.227.207.6 with HTTP; Fri, 19 Jul 2013 18:58:16 -0700 (PDT) In-Reply-To: References: Date: Fri, 19 Jul 2013 21:58:16 -0400 Message-ID: To: Yasuo Ohgaki Cc: Sara Golemon , PHP internals Content-Type: multipart/alternative; boundary=047d7b5d518edca93004e1e7c656 Subject: Re: [PHP-DEV] Operator precedence is undefined? From: theanomaly.is@gmail.com (Sherif Ramadan) --047d7b5d518edca93004e1e7c656 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Jul 19, 2013 at 8:55 PM, Yasuo Ohgaki wrote: > Hi Sara, > > 2013/7/20 Sara Golemon > > > I would ask that you don't "fix" the docs, as we want to continue to > > discourage users from engaging in unsafe behaviors. > > > If precedence is implemented correctly, there should not be any ambiguity. > If precedence is not implemented correctly, I suppose it is a bug as ++/-- > have > much higher precedence. > I don't understand how it's a bug. Precedence is implemented correctly and works as I'd expect it to. Here's the proof http://3v4l.org/mR4da/vld#tabs If you run this code through VLD you see that the opcodes clearly execute both increment operators before the addition operator. This seems to hold true from PHP 4.3.0 to 5.5.1 according to 3v4l.org. After all they do have higher precedence in the precedence table. $a = 1; ++$a // $a is now 2 $a++ // $a is still 2 and returns its value then increments to 3 (it's a POST increment) 2 + 2 // The result is clearly 4 I would say that the behavior of these operators and their precedence is very much well-defined. I don't see what the confusion. > > We don't want such docs nor bugs, don't we? > Anyone know if the doc is correct or not? > Thanks in advance. > > I don't see where there is a bug in the documentation, no. > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > --047d7b5d518edca93004e1e7c656--