Array vs Hashes

From: Date: Mon, 03 Dec 2001 21:23:01 +0000
Subject: Array vs Hashes
Groups: php.dev 
Request: Send a blank email to php-dev+get-72387@lists.php.net to get a copy of this message
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 :) Kind Regards, Daniel Lorch

« previous php.dev (#72387) next »