Re: [PHP] Strange Numeric Conversion...

2004-04-05 Thread John Nichel
Jay Blanchard wrote: [snip] naked [/snip] Dang John, I guess I don't think octally any more! John writes out his grocery list in Hex. ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Strange Numeric Conversion...

2004-04-02 Thread Monty
Why is this happening??? $id = 11; echo $id; // Displays: 9 $id = 11; echo $id; // Displays: 11 How do I make the first number (00011) display as 11? Why is it showing 9? Thanks. Monty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread John W. Holmes
From: Monty [EMAIL PROTECTED] $id = 11; echo $id; // Displays: 9 $id = 11; echo $id; // Displays: 11 How do I make the first number (00011) display as 11? Why is it showing 9? Number values starting with a leading zero are assumed to be octal values. Octal

RE: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Jay Blanchard
[snip] Why is this happening??? $id = 11; echo $id; // Displays: 9 $id = 11; echo $id; // Displays: 11 How do I make the first number (00011) display as 11? Why is it showing 9? [/snip] First of all you have naked numbers. The first one, 11, looks like a

RE: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Jay Blanchard
[snip] naked [/snip] Dang John, I guess I don't think octally any more! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Daniel Clark
Wow, thanks John ! Number values starting with a leading zero are assumed to be octal values. Octal 11 = Decimal 9 ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Monty
] Strange Numeric Conversion... [snip] Why is this happening??? $id = 11; echo $id; // Displays: 9 $id = 11; echo $id; // Displays: 11 How do I make the first number (00011) display as 11? Why is it showing 9? [/snip] First of all you have naked numbers. The first one

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Red Wingate
, 2 Apr 2004 15:38:03 -0600 To: Monty [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP] Strange Numeric Conversion... [snip] Why is this happening??? $id = 11; echo $id; // Displays: 9 $id = 11; echo $id; // Displays: 11 How do I make the first number (00011) display as 11? Why

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Red Wingate
no sense. Monty. From: [EMAIL PROTECTED] (Jay Blanchard) Newsgroups: php.general Date: Fri, 2 Apr 2004 15:38:03 -0600 To: Monty [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP] Strange Numeric Conversion... [snip] Why is this happening??? $id = 11; echo $id; // Displays: 9 $id

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Monty
] 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

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Daniel Clark
Doesn't putting and x11 tell PHP it's a decimal format? $id = 11; $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

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Red Wingate
hm ever tryed telling PHP to display the variable as an integer? echo (integer) $id ; -- red Daniel Clark wrote: Doesn't putting and x11 tell PHP it's a decimal format? $id = 11; $id2 = preg_replace(/^0+(.*)$/,\\1,$id); echo $id2; // Displays 9 echo $id;

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Daniel Clark
Found this: $a = 1234; # decimal number $a = -123; # a negative number $a = 0123; # octal number (equivalent to 83 decimal) $a = 0x1A; # hexadecimal number (equivalent to 26 decimal) http://www.phpbuilder.com/manual/language.types.integer.php#language.types.integer.casting hm ever tryed

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Curt Zirzow
* Thus wrote Daniel Clark ([EMAIL PROTECTED]): Found this: $a = 1234; # decimal number $a = -123; # a negative number $a = 0123; # octal number (equivalent to 83 decimal) $a = 0x1A; # hexadecimal number (equivalent to 26 decimal) $a is integer in all these cases, the only difference is the

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Curt Zirzow
* Thus wrote Monty ([EMAIL PROTECTED]): I tried removing the zeros, but, I get the same result: $id = 11; $id = ltrim($id, '0'); echo $id; // Displays: 9 instead of 11 ??? This didn't work either: $id = 11; settype($id, 'string'); $id

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread John Holmes
Red Wingate wrote: ever tryed telling PHP to display the variable as an integer? echo (integer) $id ; Ever tryed realizing 0x09, 011, and 9 are all integers (just different bases)? ;) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread John Holmes
Monty wrote: Thanks Red, but, still the same problem: $id = 11; $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