Re: Array vs Hashes

From: Date: Tue, 04 Dec 2001 00:08:15 +0000
Subject: Re: Array vs Hashes
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-72396@lists.php.net to get a copy of this message
$array['12'] will automagicly become $array[12] however $array['012'] will always be a string index -Jason ----- Original Message ----- From: "Daniel Lorch" <daniel@lorch.cc> To: <php-dev@lists.php.net> Sent: Monday, December 03, 2001 3:23 PM Subject: [PHP-DEV] Array vs Hashes > 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 > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.dev (#72396) next »