Re: Possible problem in the parser

From: Date: Wed, 12 Mar 2003 17:42:34 +0000
Subject: Re: Possible problem in the parser
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-95072@lists.php.net to get a copy of this message
On Wed, 12 Mar 2003, Andrey Hristov wrote: > Few minutes ago I found the following behaviour somehow wierd for me : > <?php > $a = 1; > $b = $a==1? 4:$a==2? 5:6; > printf("a[%d]b[%d]\n", $a, $b); > ?> > Prints : > a[1]b[5] > > Similar C program : > main() > { > int a,b; > a = 1; > b = a==1? 4:a==2? 5:6; > printf("a[%d]b[%d]\n", a, b); > } > Prints : > a[1]b[4] > > -=-=-=-=-=- > I think that the behavior of the C program is the right It's just a different operator precedence; it's not really wrong, just different. Derick -- "my other box is your windows PC" ------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ -------------------------------------------------------------------------

« previous php.dev (#95072) next »