Thanks Red, but, still the same problem:
$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.
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...
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php