Re: [PHP4BETA] no reverse fetch of arrays is BAD!

From: Date: Wed, 23 Feb 2000 15:11:47 +0000
Subject: Re: [PHP4BETA] no reverse fetch of arrays is BAD!
References: 1 2 3 4  Groups: php.version4 
Request: Send a blank email to php-version4+get-10731@lists.php.net to get a copy of this message
hi! Andrei Zmievski wrote: [skip] > It behooves everyone to know how PHP arrays are handled. When you say > $x[10] = "test", PHP does not allocate 11 memory blocks and fill the > last one in. It simply uses a hash to store the "test" with numeric > index 10. Thus only one block is allocated and only one value is stored. > Much more efficient. It's interesting why they're using hash instead of btree? > > Now, to answer your question, one way would be max(array_keys($x)) > which would give you back the maximum key. The problem comes in when you > start mixing numeric and string keys... > I think it's a good idea to suppose numeric values merely as strings. And to Treat all indeces as "typeless string". -- WBR, Yury Bokhoncovich, SysAdmin at FIS.

« previous php.version4 (#10731) next »