|
Posted by kaydubbleu on 12/08/07 11:36
I have found that when inserting elements into an array they stay in
the same order they are inserted, even when using numerical keys.
Example:
$a = array(4=>'Four',1=>'One',5=>'Five',2=>'Two',3=>'Three');
print_r($a);
Ouptuts:
Array
(
[4] => Four
[1] => One
[5] => Five
[2] => Two
[3] => Three
)
The only way to get them into proper order is to use ksort(). I am not
sure why this is desired functionality. If someone could please
explain I would love to know..
When inserting numerically indexed elements into an array is it
treated as an associative array?
Thanks ahead of time.
Navigation:
[Reply to this message]
|