Is this a bug, feature or what? From the code listed below
<?php
$fruits = array ( "a" => "lemon", "b" => "orange", "c" => "banana", "d" => "apple" );
sort ($fruits);
reset ($fruits);
echo "<pre>";
print_r( $fruits );
?>
I get the following output:
Array
(
[0] => apple
[1] => banana
[2] => lemon
[3] => orange
)
That's quite ok. But from this code
<?php
$fruits = array ( "a" => "lemon" );
sort ($fruits);
reset ($fruits);
echo "<pre>";
print_r( $fruits );
?>
I get:
Array
(
[a] => lemon
)
I know that we can't sort one item, but I think that right output should be:
Array
(
[0] => lemon
)
What do you think?
Simon