<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 5: bug in ArrayList-&gt;contains($element)</title><link>https://sourceforge.net/p/phrame/bugs/5/</link><description>Recent changes to 5: bug in ArrayList-&gt;contains($element)</description><atom:link href="https://sourceforge.net/p/phrame/bugs/5/feed.rss" rel="self"/><language>en</language><lastBuildDate>Mon, 15 Mar 2004 13:21:05 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/phrame/bugs/5/feed.rss" rel="self" type="application/rss+xml"/><item><title>bug in ArrayList-&gt;contains($element)</title><link>https://sourceforge.net/p/phrame/bugs/5/</link><description>&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;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Mon, 15 Mar 2004 13:21:05 -0000</pubDate><guid>https://sourceforge.net0041f8babf0738167e47a80e9edaf672cf0eaf0a</guid></item></channel></rss>