<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to 5: bug in ArrayList-&gt;contains($element)</title><link href="https://sourceforge.net/p/phrame/bugs/5/" rel="alternate"/><link href="https://sourceforge.net/p/phrame/bugs/5/feed.atom" rel="self"/><id>https://sourceforge.net/p/phrame/bugs/5/</id><updated>2004-03-15T13:21:05Z</updated><subtitle>Recent changes to 5: bug in ArrayList-&gt;contains($element)</subtitle><entry><title>bug in ArrayList-&gt;contains($element)</title><link href="https://sourceforge.net/p/phrame/bugs/5/" rel="alternate"/><published>2004-03-15T13:21:05Z</published><updated>2004-03-15T13:21:05Z</updated><author><name>Anonymous</name><uri>https://sourceforge.net/u/userid-None/</uri></author><id>https://sourceforge.net0041f8babf0738167e47a80e9edaf672cf0eaf0a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I found a bug in ArrayList-&amp;gt;contains($element).&lt;/p&gt;
&lt;p&gt;The original code makes use of array_search&lt;br /&gt;
($element,$array), which returns the index of the &lt;br /&gt;
element in the array. The issue is that if the element &lt;br /&gt;
exists in the array, and it's index is 0, the function will &lt;br /&gt;
return FALSE. To correct it I simply changed &lt;br /&gt;
array_search() for in_array()&lt;/p&gt;
&lt;p&gt;here is the complete code:&lt;/p&gt;
&lt;p&gt;arraylist.php&lt;/p&gt;
&lt;p&gt;function contains($element)&lt;br /&gt;
{&lt;br /&gt;
//return (array_search($element, &lt;br /&gt;
$this-&amp;gt;_elements)) ? TRUE : FALSE;&lt;br /&gt;
return (in_array($element, $this-&lt;br /&gt;
&amp;gt;_elements)) ? TRUE : FALSE;&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Raul Davidovich&lt;br /&gt;
r.davidovich@caconcology.com&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>