note 93098 deleted from function.array-search by danbrown
| From: | danbrown@php.net | Date: | Sun, 23 Aug 2009 17:06:28 +0000 |
| Subject: | note 93098 deleted from function.array-search by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159810@lists.php.net to get a copy of this message | ||
Note Submitter: Photis Patriotis
----
It doesn't seem as though the Binary Search algorithm would really be faster in PHP considering
that arrays are stored with keys that are variable as well.
So, PHP, internally, has to search through the keys every time $array_name[$key] is referenced
anyway. Unless PHP knows implicitly that the keys are all integers and in order, and then it can
pull the value via memory location.
This would make the binary search algorithms proposed here slower than a natively programmed array
search. Does anyone know whether this is a correct assumption?