Re: Bug #12566 Updated: Cascaded ternaries evaluate incorrectly

From: Date: Sat, 04 Aug 2001 21:19:03 +0000
Subject: Re: Bug #12566 Updated: Cascaded ternaries evaluate incorrectly
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-62092@lists.php.net to get a copy of this message
It's not a "bug," but a "feature." :) PHP has the inverse associativity of ?: compared to C (and every other language). This was originally a mistake, but now "it won't be changed," due to historical reasons. See some messages I had on php-dev back around the first week of January, 2001 on this topic. FWIW, I would like to change it. -adam On 4 Aug 2001 jeroen@php.net wrote: > ID: 12566 > Updated by: jeroen > Reported By: nick@macaw.demon.co.uk > Status: Open > Bug Type: *Programming Data Structures > Operating System: Linux > PHP Version: 4.0.6 > New Comment: > > Confirmed in latest CVS: > > --- > echo TRUE ? 'one' : TRUE ? 'two' : 'unknown'; > => two > --- > echo TRUE ? 'one' : FALSE ? 'two' : 'unknown'; > => two > --- > This definitely is a bug, and IMO a serious one. A parse error would be acceptable IMO (then > use ( and )), but this isn't. > > Previous Comments: -- adam maccabee trachtenberg adam@trachtenberg.com

« previous php.dev (#62092) next »