Re: Interesting result
| From: | Andrey Hristov | Date: | Sun, 22 Dec 2002 08:26:08 +0000 |
| Subject: | Re: Interesting result | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-92775@lists.php.net to get a copy of this message | ||
oukei, stopping to ask anymore :))
Andrey
----- Original Message -----
From: "Andi Gutmans" <andi@zend.com>
To: "Andrey Hristov" <andrey@webgate.bg>; <php-dev@lists.php.net>
Sent: Saturday, December 21, 2002 7:20 PM
Subject: Re: [PHP-DEV] Interesting result
> Again, as it is undefined in PHP the question "Why" in itself is wrong :)
>
> Andi
>
> At 04:43 PM 12/21/2002 +0200, Andrey Hristov wrote:
>
> >----- Original Message -----
> >From: "Andi Gutmans" <andi@zend.com>
> >To: "Andrey Hristov" <andrey@webgate.bg>; <php-dev@lists.php.net>
> >Sent: Saturday, December 21, 2002 4:17 PM
> >Subject: Re: [PHP-DEV] Interesting result
> >
> >
> > > It doesn't matter because the behavior here is undefined just like in
C.
> > > You can't use a variable and it's post/pre increment value in the same
> > > expression.
> > >
> >
> >Two years ago I've been told by a professort that a+++a+++a depends on
the
> >language and the compiler. Yesterday i found this page :
> >http://www.blueshoes.org/en/developer/syntax_exam/
> >If a=1 ->
> >Java : 6
> >PHP : 6
> >gcc 2.95 : 3
> >
> >I know that is "on the edge" and I will never use it in real script by I
was
> >curious why the
> >reference change the result.
> >
> >Best wishes,
> >Andrey
> >
> > >
> > > At 03:26 PM 12/21/2002 +0200, Andrey Hristov wrote:
> > > > Hi,
> > > >i got an interesting case :
> > > >
> > > ><?php
> > > >$a = 1;
> > > >var_dump($a + $a++);
> > > >
> > > >
> > > >$a = 1;
> > > >$x = &$a;
> > > >var_dump($a + $a++);
> > > >
> > > >?>
> > > >Result
> > > >int(2)
> > > >int(3)
> > > >
>