<?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: PHP wish list &#8211; part 1: foreachif()</title>
	<atom:link href="http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/feed/" rel="self" type="application/rss+xml" />
	<link>http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/</link>
	<description>Bringing together the fine arts of programming and death metal.</description>
	<lastBuildDate>Mon, 01 Aug 2011 12:51:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Ezzatron &#187; Revisited: foreachif()</title>
		<link>http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/comment-page-1/#comment-97</link>
		<dc:creator>Ezzatron &#187; Revisited: foreachif()</dc:creator>
		<pubDate>Wed, 22 Jul 2009 07:39:36 +0000</pubDate>
		<guid isPermaLink="false">http://ezzatron.com/?p=3#comment-97</guid>
		<description>[...] while ago I blogged about my desire for a foreachif() construct in PHP. A recent comment from a reader made me re-think the concept and consider ways in which it could be [...]</description>
		<content:encoded><![CDATA[<p>[...] while ago I blogged about my desire for a foreachif() construct in PHP. A recent comment from a reader made me re-think the concept and consider ways in which it could be [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erin</title>
		<link>http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/comment-page-1/#comment-96</link>
		<dc:creator>Erin</dc:creator>
		<pubDate>Wed, 22 Jul 2009 05:30:37 +0000</pubDate>
		<guid isPermaLink="false">http://ezzatron.com/?p=3#comment-96</guid>
		<description>You certainly have a valid point, the last thing I would want is for PHP to end up like Perl.

Looking back at this article I believe I wanted this functionality because I had just started using PHP as a templating system instead of Smarty, and I was missing some of its handy functionality somewhat.

In regards to rolling your own with eval()&#039;d string, yes that could work, but could make debugging more difficult and completely voids any special features provided by your IDE.

A more elegant solution could be to use PHP &gt; 5.3 with the new closures feature ( http://php.net/closures ), although it will be a while before IDEs know how to handle them. Perhaps I&#039;ll write a quick post to demonstrate...</description>
		<content:encoded><![CDATA[<p>You certainly have a valid point, the last thing I would want is for PHP to end up like Perl.</p>
<p>Looking back at this article I believe I wanted this functionality because I had just started using PHP as a templating system instead of Smarty, and I was missing some of its handy functionality somewhat.</p>
<p>In regards to rolling your own with eval()&#8217;d string, yes that could work, but could make debugging more difficult and completely voids any special features provided by your IDE.</p>
<p>A more elegant solution could be to use PHP > 5.3 with the new closures feature ( <a href="http://php.net/closures" rel="nofollow">http://php.net/closures</a> ), although it will be a while before IDEs know how to handle them. Perhaps I&#8217;ll write a quick post to demonstrate&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elliott</title>
		<link>http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/comment-page-1/#comment-94</link>
		<dc:creator>Elliott</dc:creator>
		<pubDate>Tue, 21 Jul 2009 05:25:55 +0000</pubDate>
		<guid isPermaLink="false">http://ezzatron.com/?p=3#comment-94</guid>
		<description>You could always build your own foreachif function that accepts and evaluates a string. 

The whole thing seems like an exercise in unintentional obfuscation to me, though.</description>
		<content:encoded><![CDATA[<p>You could always build your own foreachif function that accepts and evaluates a string. </p>
<p>The whole thing seems like an exercise in unintentional obfuscation to me, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erin</title>
		<link>http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/comment-page-1/#comment-21</link>
		<dc:creator>Erin</dc:creator>
		<pubDate>Sun, 14 Dec 2008 23:17:52 +0000</pubDate>
		<guid isPermaLink="false">http://ezzatron.com/?p=3#comment-21</guid>
		<description>Yes and no...

On the one hand it would be nice if PHP didn&#039;t force you to check existence AND type before using a variable in a foreach() loop, on the other I&#039;d hate PHP to suffer from the same situation as JavaScript where things just fail silently and bugs can easily slip through without being noticed.

Perhaps if is_array() and other variable type-checking functions could handle undefined variables? Hmmm... sounds like another wish list item :)</description>
		<content:encoded><![CDATA[<p>Yes and no&#8230;</p>
<p>On the one hand it would be nice if PHP didn&#8217;t force you to check existence AND type before using a variable in a foreach() loop, on the other I&#8217;d hate PHP to suffer from the same situation as JavaScript where things just fail silently and bugs can easily slip through without being noticed.</p>
<p>Perhaps if is_array() and other variable type-checking functions could handle undefined variables? Hmmm&#8230; sounds like another wish list item <img src='http://ezzatron.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Horus Kol</title>
		<link>http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/comment-page-1/#comment-20</link>
		<dc:creator>Horus Kol</dc:creator>
		<pubDate>Sun, 14 Dec 2008 22:41:54 +0000</pubDate>
		<guid isPermaLink="false">http://ezzatron.com/?p=3#comment-20</guid>
		<description>heh - probably should have read your examples... similar arguments on complexity and readability there - having the condition inline with the foreach does not make the script clear.

But do you agree on my comment about PHP errors on foreach&#039;ing an empty array?</description>
		<content:encoded><![CDATA[<p>heh &#8211; probably should have read your examples&#8230; similar arguments on complexity and readability there &#8211; having the condition inline with the foreach does not make the script clear.</p>
<p>But do you agree on my comment about PHP errors on foreach&#8217;ing an empty array?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erin</title>
		<link>http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/comment-page-1/#comment-16</link>
		<dc:creator>Erin</dc:creator>
		<pubDate>Sat, 13 Dec 2008 03:19:06 +0000</pubDate>
		<guid isPermaLink="false">http://ezzatron.com/?p=3#comment-16</guid>
		<description>Ah! Now I understand your last comment better. Actually, I think you may have the wrong idea about what I meant by foreachif.

The idea is NOT to skip the whole construct when the expression returns false, but to evaluate the expression every time the loop iterates, and skip ONLY that single iteration if the result is false.

Either that or I&#039;m not picking up what you&#039;re putting down :)</description>
		<content:encoded><![CDATA[<p>Ah! Now I understand your last comment better. Actually, I think you may have the wrong idea about what I meant by foreachif.</p>
<p>The idea is NOT to skip the whole construct when the expression returns false, but to evaluate the expression every time the loop iterates, and skip ONLY that single iteration if the result is false.</p>
<p>Either that or I&#8217;m not picking up what you&#8217;re putting down <img src='http://ezzatron.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Jones</title>
		<link>http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/comment-page-1/#comment-14</link>
		<dc:creator>Stuart Jones</dc:creator>
		<pubDate>Fri, 12 Dec 2008 12:46:48 +0000</pubDate>
		<guid isPermaLink="false">http://ezzatron.com/?p=3#comment-14</guid>
		<description>thinking about it... I think that if PHP simply stopped going gaga over an empty array or non-array being used in the foreach, that would be sufficient...</description>
		<content:encoded><![CDATA[<p>thinking about it&#8230; I think that if PHP simply stopped going gaga over an empty array or non-array being used in the foreach, that would be sufficient&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ezzatron</title>
		<link>http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/comment-page-1/#comment-11</link>
		<dc:creator>Ezzatron</dc:creator>
		<pubDate>Fri, 12 Dec 2008 06:38:43 +0000</pubDate>
		<guid isPermaLink="false">http://ezzatron.com/?p=3#comment-11</guid>
		<description>[...] If you missed part 1 (you probably did), you can read it here. [...]</description>
		<content:encoded><![CDATA[<p>[...] If you missed part 1 (you probably did), you can read it here. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erin</title>
		<link>http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/comment-page-1/#comment-10</link>
		<dc:creator>Erin</dc:creator>
		<pubDate>Fri, 12 Dec 2008 00:12:38 +0000</pubDate>
		<guid isPermaLink="false">http://ezzatron.com/?p=3#comment-10</guid>
		<description>Yes, an else clause on foreach() statements would be nice too, and I did consider adding it to this article.

In the end I decided to leave it out and focus on one thing at a time. Perhaps I will write another PHP wish list article to cover that.</description>
		<content:encoded><![CDATA[<p>Yes, an else clause on foreach() statements would be nice too, and I did consider adding it to this article.</p>
<p>In the end I decided to leave it out and focus on one thing at a time. Perhaps I will write another PHP wish list article to cover that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Horus Kol</title>
		<link>http://ezzatron.com/2008/12/04/php-wishlist-part-1-foreachif/comment-page-1/#comment-9</link>
		<dc:creator>Horus Kol</dc:creator>
		<pubDate>Thu, 11 Dec 2008 23:23:17 +0000</pubDate>
		<guid isPermaLink="false">http://ezzatron.com/?p=3#comment-9</guid>
		<description>I&#039;m surprised you didn&#039;t go as far as suggest a &quot;foreachelse&quot;?

I already think that PHP suffers from an overbloat of functions and codes, and actually could do with more simplification instead of worrying about having to write:

if (is_array($x)) { foreach ($x =&gt; $stuff) { ... } }</description>
		<content:encoded><![CDATA[<p>I&#8217;m surprised you didn&#8217;t go as far as suggest a &#8220;foreachelse&#8221;?</p>
<p>I already think that PHP suffers from an overbloat of functions and codes, and actually could do with more simplification instead of worrying about having to write:</p>
<p>if (is_array($x)) { foreach ($x =&gt; $stuff) { &#8230; } }</p>
]]></content:encoded>
	</item>
</channel>
</rss>

