On Mon, 03 Dec 2001, Daniel Lorch wrote:
> Hi,
> 
> I don't know whether this was already discussed before, but ..
> 
> have you ever though about the fact that PHP is not very cleanly
> designed when looking at Arrays and Hashes? How can I predict whether
> a array/hash is sorted by it's INTEGER indices or it's STRING indices
> when using functions such as asort(), ksort() .. I don't know whether
> these indices are casted into the other type or not. Maybe, by
> accident I write $array['12'] = .. and from then PHP thinks I'm using
> string indices (thus casting all indices to string).
> 
> Of couse, I could just try out but that isn't really a proper and
> clean language design. Shouldn't it be possible to FORCE either
> method? such as
> 
>  i_asort();
>  str_asort();
> 
> ok, that's a quite stupid proposal but you get the idea I hope :)

Eh, you can.

asort($array, SORT_NUMERIC);
asort($array, SORT_STRING);

-Andrei

As I was going up the stair, I met a man who wasn't there.
He wasn't there again today. I wish, I wish he'd stay away.
                                                        -Hughes Mearns


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to