Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have to disagree also.

The order inserted makes most sense in most cases. Hand crafting integer based array indexes out of order is rare. And as you say a simple ksort call guarantees sort order.

    ksort($arr);
    echo join($arr, ", ");
    // one, two, three


Exactly. Of you hand craft an array you probably need it in that order.


Then why not put it in order while you're hand crafting it?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: