Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21590 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79396 invoked by uid 1010); 20 Jan 2006 16:47:41 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 79381 invoked from network); 20 Jan 2006 16:47:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jan 2006 16:47:41 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:32755] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 91/7E-05698-72411D34 for ; Fri, 20 Jan 2006 11:47:36 -0500 Received: (qmail 2732 invoked from network); 20 Jan 2006 16:47:32 -0000 Received: from localhost (HELO ANDI-NOTEBOOK.zend.com) (127.0.0.1) by localhost with SMTP; 20 Jan 2006 16:47:32 -0000 Message-ID: <7.0.0.16.2.20060120084700.044526d8@zend.com> X-Mailer: QUALCOMM Windows Eudora Version 7.0.0.16 Date: Fri, 20 Jan 2006 08:47:28 -0800 To: "Carl P. Corliss" ,internals@lists.php.net In-Reply-To: References: <20060120113601.GL17465@alcopop.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] 23 nothing is so as it seems, but why From: andi@zend.com (Andi Gutmans) Guys, please take this offlist. Undefined means undefined. There's no assumed way of it working. Andi At 07:14 AM 1/20/2006, Carl P. Corliss wrote: >Jon Dowland wrote: >>On Thu, Jan 19, 2006 at 06:41:17PM +0200, Marco Kaiser wrote: >> >>>Today during a session i had a strange "magic" feature found in php. >>> >>>>>$a = 10; >>>echo ++$a + $a++; >>>?> >>> >>>this works perfect as expected. it returns 22. >> >>Odd, I expected 21: >> echo (11 + 10) >> a = a + 1 > >nope - discounting the 'undefined behavior' of using pre/post >increment operators, 22 would be the correct assumption - remember, >broken into seperate statements, it's effectively: > >$a = 10; >$a = $a + 1; // $a == 11 >$a + $a; // $a == 22 > >echo $a; > >$a = $a + 1; // $a == 23 > > >Cheers, > >-- >Carl > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php