Re: Strange Numeric Conversion...
| From: | John Holmes | Date: | Fri, 02 Apr 2004 23:52:38 +0000 |
| Subject: | Re: Strange Numeric Conversion... | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182215@lists.php.net to get a copy of this message | ||
Monty wrote:
Thanks Red, but, still the same problem:011 and 9 are the exact same number, but represented in different bases! Maybe this is the concept you're not grasping. When you say $id = 000011, then you're telling PHP to assign the value of 9 to $id, plain and simple. Can we take a step back here and ask where you're getting "000011" from? ---John Holmes...$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.