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

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 o

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: http://www.php.n

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');

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 i

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 try

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
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 >

Re: [PHP] Strange Numeric Conversion...

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

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Red Wingate
f PHP sees this as an octal, then why does gettype(11) = INTEGER? This makes 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]> Subjec

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Red Wingate
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

Re: [PHP] Strange Numeric Conversion...

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

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 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 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 bi

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 valu

[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: ht