Re: Strange Numeric Conversion...
| From: | Red Wingate | Date: | Fri, 02 Apr 2004 22:51:57 +0000 |
| Subject: | Re: Strange Numeric Conversion... | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182210@lists.php.net to get a copy of this message | ||
hmmmmm
ever tryed telling PHP to display the variable as an integer?
echo (integer) $id ;
-- red
Daniel Clark wrote:
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.