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
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
2 matches
Mail list logo