<?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: Removing empty elements from an array</title>
	<atom:link href="http://jelaniharris.com/2010/removing-empty-elements-from-an-array/feed/" rel="self" type="application/rss+xml" />
	<link>http://jelaniharris.com/2010/removing-empty-elements-from-an-array/</link>
	<description>The original website of Jelani Harris the original of course</description>
	<lastBuildDate>Wed, 01 Feb 2012 12:13:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Mike</title>
		<link>http://jelaniharris.com/2010/removing-empty-elements-from-an-array/comment-page-1/#comment-79</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 07 May 2010 15:13:33 +0000</pubDate>
		<guid isPermaLink="false">http://jelaniharris.com/?p=90#comment-79</guid>
		<description>I&#039;ll have to use that - I rely on isset() for a portion of my error checking in PHP, and it&#039;d be useful to know that an array is already scrubbed of empty fields coming into the routine.  You might find this useful, too - it&#039;s a routine I&#039;ve been using to vet user input for SQL queries:

function safeQueryParam($candidate = NULL){

   $returnStr = NULL;
   $pattern = &#039;/[^a-zA-Z0-9]/&#039;;

   if($candidate)
      $tempStr = preg_replace($pattern, &#039;&#039;, $candidate);

   if($tempStr != null &amp;&amp; $tempStr != &quot;&quot;)
      $returnStr = $tempStr;

   return $returnStr;

}

It removes any characters from the passed string that aren&#039;t in $pattern (for this application, I was only looking for alphanumeric characters).</description>
		<content:encoded><![CDATA[<p>I&#8217;ll have to use that &#8211; I rely on isset() for a portion of my error checking in PHP, and it&#8217;d be useful to know that an array is already scrubbed of empty fields coming into the routine.  You might find this useful, too &#8211; it&#8217;s a routine I&#8217;ve been using to vet user input for SQL queries:</p>
<p>function safeQueryParam($candidate = NULL){</p>
<p>   $returnStr = NULL;<br />
   $pattern = &#8216;/[^a-zA-Z0-9]/&#8217;;</p>
<p>   if($candidate)<br />
      $tempStr = preg_replace($pattern, &#8221;, $candidate);</p>
<p>   if($tempStr != null &amp;&amp; $tempStr != &#8220;&#8221;)<br />
      $returnStr = $tempStr;</p>
<p>   return $returnStr;</p>
<p>}</p>
<p>It removes any characters from the passed string that aren&#8217;t in $pattern (for this application, I was only looking for alphanumeric characters).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

