Re: [PHP4BETA] no reverse fetch of arrays is BAD!
| From: | Faisal Nasim | Date: | Wed, 23 Feb 2000 15:10:39 +0000 |
| Subject: | Re: [PHP4BETA] no reverse fetch of arrays is BAD! | ||
| References: | 1 2 3 4 5 6 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-10732@lists.php.net to get a copy of this message | ||
: > 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.
I would have to see it to believe it, I'll run some benchmarks
against Perl.
:
: > 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?
If you claim that it doesn't cause any overhead, I would believe you,
and then there is no need for 'numeric-only' arrays....
Only if you could provide local variable-scoping, I would be more
than happy! (hey, this kid is asking for more and more everytime!) ;-)
Enjoy!
Faisal