Re: ++ bug or unexpected behaviour

From: Date: Sat, 10 Jun 2000 23:20:57 +0000
Subject: Re: ++ bug or unexpected behaviour
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-20980@lists.php.net to get a copy of this message
Well, in a perfect world, most operations on NULL have undefined results. In PHP they happen to be defined because of a downwards compatibility issue, but you shouldn't draw any conclusions from that... At 22:08 10/06/2000, waldschrott wrote:
That´s the point. I thought ++ would change the type too, because NULL++ results in 1... Zeev Suraski wrote:
It is; For downwards compatibility, $foo++ when $foo is NULL results in 1. Zeev On Sat, 10 Jun 2000, Jade Nicoletti wrote:
On Sat, Jun 10, 2000 at 07:18:01PM +0300, Zeev Suraski wrote:
On Sat, 10 Jun 2000, waldschrott wrote:
I think "$t++" and "$t=$t+1" should produces the same results,
shouldn´t > > > they?
No. ++ means increment, while not changing type. $foo+1 means an
arithmetic addition of one, which always results in a conversion to a number. Is NULL not it's own type? ;)) [NULL++ results in (int) 1] -Jade.
--
o----------0-¬---------O-·---¬----o---®-----o o    O   °       .
| http://www.kiffen.de | pRoteçt y0ur bRaín |0  O °     ¤  °        ·
0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ ° o © ° . ·
| psychedelic experience |  gott@kiffen.de  | O   ° o           °
o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ ·
-- Zeev Suraski <zeev@zend.com> http://www.zend.com/

« previous php.dev (#20980) next »