Re: Something interesting I found in PHP manual

From: Date: Thu, 12 Jun 2003 11:07:28 +0000
Subject: Re: Something interesting I found in PHP manual
References: 1  Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-18668@lists.php.net to get a copy of this message
Please submit this as a "documentation problem" at bugs.php.net. Thanks, Goba rsen010@ec.auckland.ac.nz írta:
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 I’m correct. Thanks Naleen


« previous php.mirrors (#18668) next »