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. 


> From: [EMAIL PROTECTED] (Red Wingate)
> Organization: ErisX Development
> Reply-To: [EMAIL PROTECTED]
> Newsgroups: php.general
> Date: Sat, 03 Apr 2004 00:01:43 +0200
> To: [EMAIL PROTECTED]
> Cc: Monty <[EMAIL PROTECTED]>,  [EMAIL PROTECTED]
> Subject: Re: [PHP] Strange Numeric Conversion...
> 
> sry... it's \\1 instead of //1 ... guess i had one to many beers :)
> 
> Red Wingate wrote:
> 
>> trim will not work, try something like:
>> 
>> $id = preg_replace("/^0+(.*)$/","//1",$id);
>> 
>> instead
>> 
>> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to