Re: Strange Numeric Conversion...

From: Date: Fri, 02 Apr 2004 22:38:48 +0000
Subject: Re: Strange Numeric Conversion...
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-182209@lists.php.net to get a copy of this message
Doesn't putting and x000011 tell PHP it's a decimal format? > $id = 000011; > $id2 = preg_replace("/^0+(.*)$/","\\1",$id); > > echo $id2; // Displays 9 > echo $id; // Displays 9 as well. > > If the number begins with a zero, there seems to be no way to tell PHP > this > is an integer, not an octal. The conversion happens as soon as the number > is > stored in the variable, it appears, which is why everything done > afterwards > makes no difference, because $id=000011; seems to be stored as $id=>9 by > PHP.

« previous php.general (#182209) next »