Re: [PHP] Leading zeros in array index

2002-04-19 Thread Joshua b. Jore

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Oh it's probably because your numbers are being interpreted as octal.
Either use the array as '00' .. '09' or just 0 .. 9. 00 .. 09 is valid for
00 to 07 but there is no such thing as 08 and 09 in octal.

Joshua b. Jore
http://www.greentechnologist.org

On Fri, 19 Apr 2002, Kent Briggs wrote:

> My first post here, sorry if this has been covered before:
>
> Why does including a leading zero in an array index cause
> problems? For example, the output of this script:
>
> 
>
> $x = array("a","b","c","d","e","f","g","h","i","j");
>
> echo $x[0];
> echo $x[1];
> echo $x[2];
> echo $x[3];
> echo $x[4];
> echo $x[5];
> echo $x[6];
> echo $x[7];
> echo $x[8];
> echo $x[9];
>
> echo "";
>
> echo $x[00];
> echo $x[01];
> echo $x[02];
> echo $x[03];
> echo $x[04];
> echo $x[05];
> echo $x[06];
> echo $x[07];
> echo $x[08];
> echo $x[09];
>
> -
>
> returns this result:
>
> abcdefghij
> abcdefghaa
>
> The [08] and [09] values are messed up but [00] thru [07] are
> ok.
>
> --
> Kent Briggs, [EMAIL PROTECTED]
> Briggs Softworks, http://www.briggsoft.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (OpenBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE8wJg3fexLsowstzcRAuB5AKDQHKjsW20dLYEGy1EtCjWVR33rAQCgzKvM
XrOBdgtSSpa0L23Y1jvCB40=
=RJw6
-END PGP SIGNATURE-


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




Re: [PHP] Leading zeros in array index

2002-04-19 Thread Kent Briggs


"Joshua B. Jore" wrote:
> 
> Oh it's probably because your numbers are being interpreted as octal.
> Either use the array as '00' .. '09' or just 0 .. 9. 00 .. 09 is valid for
> 00 to 07 but there is no such thing as 08 and 09 in octal.

Ok, thanks.

-- 
Kent Briggs, [EMAIL PROTECTED]
Briggs Softworks, http://www.briggsoft.com

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