Re: Bug #1235: string arithmetical misbehaviour

From: Date: Mon, 15 Mar 1999 18:16:37 +0000
Subject: Re: Bug #1235: string arithmetical misbehaviour
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-4628@lists.php.net to get a copy of this message
At 11:13 15/03/99 -0000, tolj@pwi.de wrote: >From: tolj@pwi.de >Operating system: Linux 2.0.36 >PHP version: 3.0.7 >PHP Bug Type: Misbehaving function >Bug description: string arithmetical misbehaviour > >what about this misbehaviour of string arithmetics: > >$foo = "04"; >$foo++; >echo $foo; ## reports "05" > >$foo = "04"; >$foo--; >echo $foo; ## reports "3" without leading zero !! > >I suppose both should react the same, or am I wrong?! I tried to close the bug in the bugs database but my password doesn't seem to work anymore. Any ideas? Where has the username field gone? :) ----------------------------------------------------------------- Only increment works with strings in PHP, decrement doesn't. When you decrement a string it gets converted to a long and is then decremented. The reason is that like Perl, we didn't see much use for string increment/decrement except for testing purposes and creating unqiue ideas so increment should be enough. Andi --- Andi Gutmans <andi@zend.com> ICQ: 1568297 PGP: finger andi@vipe.technion.ac.il -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#4628) next »