note 93098 added to function.array-search

From: Date: Sun, 23 Aug 2009 14:31:04 +0000
Subject: note 93098 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-159801@lists.php.net to get a copy of this message
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? ---- Server IP: 64.71.164.2 Probable Submitter: 216.26.96.36 ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- https://master.php.net/note/edit/93098 Del: integrated -- https://master.php.net/note/delete/93098/integrated Del: useless -- https://master.php.net/note/delete/93098/useless Del: bad code -- https://master.php.net/note/delete/93098/bad+code Del: spam -- https://master.php.net/note/delete/93098/spam Del: non-english -- https://master.php.net/note/delete/93098/non-english Del: in docs -- https://master.php.net/note/delete/93098/in+docs Del: other reasons-- https://master.php.net/note/delete/93098 Reject -- https://master.php.net/note/reject/93098 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159801) next »