<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Filtering Array Elements in PHP Using an Anonymous Function</title>
	<atom:link href="http://neverusethisfont.com/blog/2009/02/filtering-array-elements-in-php-using-an-anonymous-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://neverusethisfont.com/blog/2009/02/filtering-array-elements-in-php-using-an-anonymous-function/</link>
	<description>Ramblings of a Designer/Programmer</description>
	<lastBuildDate>Thu, 20 May 2010 01:16:01 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Paul</title>
		<link>http://neverusethisfont.com/blog/2009/02/filtering-array-elements-in-php-using-an-anonymous-function/comment-page-1/#comment-3863</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Tue, 10 Feb 2009 02:38:29 +0000</pubDate>
		<guid isPermaLink="false">http://neverusethisfont.com/blog/2009/02/filtering-array-elements-in-php-using-an-anonymous-function/#comment-3863</guid>
		<description>I was testing with a filter set that returned no results O.O it&#039;s still about 2x faster.</description>
		<content:encoded><![CDATA[<p>I was testing with a filter set that returned no results O.O it&#8217;s still about 2x faster.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://neverusethisfont.com/blog/2009/02/filtering-array-elements-in-php-using-an-anonymous-function/comment-page-1/#comment-3862</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Tue, 10 Feb 2009 02:28:08 +0000</pubDate>
		<guid isPermaLink="false">http://neverusethisfont.com/blog/2009/02/filtering-array-elements-in-php-using-an-anonymous-function/#comment-3862</guid>
		<description>You can achieve the same functionality about 10x faster using static variables.

foreach ($_GET as $k =&gt; $v) {
  filterer($k, $v);
  $data = array_filter($data, &#039;filterer&#039;);
}

function filterer($var, $val = false) {
  static $key, $value;
  if ($val) {
    $key = $var;
    $value = $val;
    return;
  }
  return strpos($var[$key], $value) !== false;
}</description>
		<content:encoded><![CDATA[<p>You can achieve the same functionality about 10x faster using static variables.</p>
<p>foreach ($_GET as $k =&gt; $v) {<br />
  filterer($k, $v);<br />
  $data = array_filter($data, &#8216;filterer&#8217;);<br />
}</p>
<p>function filterer($var, $val = false) {<br />
  static $key, $value;<br />
  if ($val) {<br />
    $key = $var;<br />
    $value = $val;<br />
    return;<br />
  }<br />
  return strpos($var[$key], $value) !== false;<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
