www.php.net/manual/en/language.types.array.php is inconsistent on the issue
of integer keys for arrays.
Right at the start we have:
------------------------------------
array( [key =>] value
, ...
)
// key is either string or nonnegative integer
// value can be anything
-------------------------------------
which to my mind rules out negative integers as keys. as someone well versed
in traditional arrays that sees reasonable!
However, later we have:
--------------------------------------------
If you omit a key, the maximum of the integer-indices is taken, and the new
key will be that maximum + 1. As integers can be negative, this is also true
for negative indices. Having e.g. the highest index being -6 will result
in -5 being the new key. If no integer-indices exist yet, the key will be 0
(zero). If you specify a key that already has a value assigned to it, that
value will be overwritten.
-----------------------------------------------
which implies that negative integers are ok as a key!
Which is correct?
______________________________________
Keith Underdown
Q Consultancy
8A New Rowley Rd
DUDLEY
DY2 8AS
+44 1384 231180
+44 7798 934782
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php