Bug #10734: Strange conversion string->numbers

From: Date: Tue, 08 May 2001 15:26:43 +0000
Subject: Bug #10734: Strange conversion string->numbers
Groups: php.dev 
Request: Send a blank email to php-dev+get-54399@lists.php.net to get a copy of this message
From: konrad@interdata.net.pl Operating system: Linux 2.2 glibc-2.2.1 PHP version: 4.0.5 PHP Bug Type: *General Issues Bug description: Strange conversion string-&gt;numbers Here is a simple code <? header("content-type: text/plain"); $num = -5; echo "$num\n"; $num++; echo "$num\n"; $num--; echo "$num\n"; echo "----------\n"; $num = "-5"; echo "$num\n"; $num++; echo "$num\n"; $num--; echo "$num\n"; ?> And here results -5 -4 -5 ---------- -5 -6 <-- ????????????????? -7 It looks like "++" operator do not work properly on variables enclosed in double-quotes. Other operators (ie $num = $num +1) woks properly. -- Edit Bug report at: http://bugs.php.net/?id=10734&edit=1

« previous php.dev (#54399) next »