Re: [PHP4BETA] no reverse fetch of arrays is BAD!
| From: | Andrei Zmievski | Date: | Wed, 23 Feb 2000 15:04:30 +0000 |
| Subject: | Re: [PHP4BETA] no reverse fetch of arrays is BAD! | ||
| References: | 1 2 3 4 5 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-10729@lists.php.net to get a copy of this message | ||
On Wed, 23 Feb 2000, Faisal Nasim wrote:
> But still it will be string in nature (that 10, I assume), and you'd lookup:
> $array [10] in a linked list or whatever through strcmp (or some
> custom function, memcmp perhaps...) which will be slower compared
> to numeric lookup as in a plain, old-fashioned array.... wouldn't it?
> You can do the same thing in perl with associative arrays, but there
> are plain arrays too, which are alot faster!
No, PHP arrays are implemented using hashtables which are very fast.
Trust me.
> Can't we have a nice type which makes an array truly numerical? And
> would give an error when you try add a non-numerical (actually positive
> integer)
> value? (as I see that rewriting another model for plain arrays can
> break A LOT of things!)
>
> Suggestion: settype ( $MYARRAY , "numericarray" )
Why? What is the advantage of having numeric only array?
-Andrei
* If it's never finished, you can't prove it doesn't work. *