Re: Something interesting I found in PHP manual
| From: | rsen010 at ec dot auckland dot ac dot nz | Date: | Thu, 12 Jun 2003 09:17:58 +0000 |
| Subject: | Re: Something interesting I found in PHP manual | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-18664@lists.php.net to get a copy of this message | ||
Quoting rsen010@ec.auckland.ac.nz:
> Hi,
> When I was going through Chapter 7.types in PHP manual I found something
> confusing regarding the following statement Having e.g. the highest index
> being -6 will result in -5 being the new key (under Syntax specifying with
>
> array()).
> What actually happens is it Php starts indexing from zero if lowest index is
>
> negative value unless there is no index of zero.
> But amazing thing is sometimes it omit some values unless.
> Just consider the following examples.
> Ex:1
> $a = array(-3=>'February', 'March');
> print_r($a);
> This will prints out the folloiwng
> Array ( [-3] => February [0] => March )
>
>
> Ex:2
> $a = array( 'January', '0'=>'a','b', 'c',
> -3=>'February', 'March');
> print_r($a);
>
> This will prints out the folloiwng
> Array ( [0] => a [1] => b [2] => c [-3] => February [3] => March )
>
> Please be kind to check this out if Im correct.
> Thanks
> Naleen
>
>
>
>