Re: [PHP] in_array algorithm

2002-02-06 Thread Lars Torben Wilson
On Wed, 2002-02-06 at 08:26, John Fulton wrote: > > Does anyone know which algorithm in_array() uses? > > For example, if I say > > in_array("foo", $arr) > > Does in_array() do an unordered sequential serach of $arr for > "foo" which takes up to n comparisons [where n = count($arr)], > or d

[PHP] in_array algorithm

2002-02-06 Thread John Fulton
Does anyone know which algorithm in_array() uses? For example, if I say in_array("foo", $arr) Does in_array() do an unordered sequential serach of $arr for "foo" which takes up to n comparisons [where n = count($arr)], or does it do a binary search which takes about lg(n) comparisons? Is