<?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: Nice trick with FOR loop</title>
	<atom:link href="http://programmersnotes.info/2009/02/20/nice-trick-with-for-loop/feed/" rel="self" type="application/rss+xml" />
	<link>http://programmersnotes.info/2009/02/20/nice-trick-with-for-loop/</link>
	<description>Notes on the web-development and artificial intelligence.</description>
	<lastBuildDate>Wed, 25 Jan 2012 22:21:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: jz</title>
		<link>http://programmersnotes.info/2009/02/20/nice-trick-with-for-loop/comment-page-1/#comment-12</link>
		<dc:creator>jz</dc:creator>
		<pubDate>Tue, 26 May 2009 23:21:12 +0000</pubDate>
		<guid isPermaLink="false">http://konstantin.takeforce.net/?p=8#comment-12</guid>
		<description>I use described practice in C++ and for huge arrays in PHP. And yes, this is only one trick with &quot;for&quot; loop, no more.

P.S. Забавно, как такая простая и человеческая заметка о маленькой хитрости, не претендующая на отчёт о тестировании и описание какой-то парадигмы программирования, заполучила столько пространных комментариев, доходящих разговоров о MVC :)

-----------------
Translation by Konstantin:
P. S. It&#039;s funny to see, how this simple and useful note about the little trick, that doesn&#039;t claim to be some testing report or description of some development paradigm, got so many large comments, that lead to MVC discussion :)</description>
		<content:encoded><![CDATA[<p>I use described practice in C++ and for huge arrays in PHP. And yes, this is only one trick with &#8220;for&#8221; loop, no more.</p>
<p>P.S. Забавно, как такая простая и человеческая заметка о маленькой хитрости, не претендующая на отчёт о тестировании и описание какой-то парадигмы программирования, заполучила столько пространных комментариев, доходящих разговоров о MVC <img src='http://programmersnotes.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Translation by Konstantin:<br />
P. S. It&#8217;s funny to see, how this simple and useful note about the little trick, that doesn&#8217;t claim to be some testing report or description of some development paradigm, got so many large comments, that lead to MVC discussion <img src='http://programmersnotes.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Konstantin Mirin</title>
		<link>http://programmersnotes.info/2009/02/20/nice-trick-with-for-loop/comment-page-1/#comment-11</link>
		<dc:creator>Konstantin Mirin</dc:creator>
		<pubDate>Tue, 26 May 2009 06:04:32 +0000</pubDate>
		<guid isPermaLink="false">http://konstantin.takeforce.net/?p=8#comment-11</guid>
		<description>Universal - yes. But is it really a good idea to use foreach when sorting? :) I just showed how to get rid of unnecessary extra line using the comma operator.</description>
		<content:encoded><![CDATA[<p>Universal &#8211; yes. But is it really a good idea to use foreach when sorting? <img src='http://programmersnotes.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I just showed how to get rid of unnecessary extra line using the comma operator.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jz</title>
		<link>http://programmersnotes.info/2009/02/20/nice-trick-with-for-loop/comment-page-1/#comment-10</link>
		<dc:creator>jz</dc:creator>
		<pubDate>Tue, 26 May 2009 01:32:24 +0000</pubDate>
		<guid isPermaLink="false">http://konstantin.takeforce.net/?p=8#comment-10</guid>
		<description>IMHO, &quot;foreach&quot; is universal way to iterate over arrays. For &quot;for&quot;, if you change some code from &quot;array($a, $b)&quot; to &quot;array(&#039;a&#039;=&gt;$a, &#039;b&#039;=&gt;$b)&quot; you must rewrite other code (MVC example: rewrite code in controller =&gt; rewrite code in view). However, this is rare case.</description>
		<content:encoded><![CDATA[<p>IMHO, &#8220;foreach&#8221; is universal way to iterate over arrays. For &#8220;for&#8221;, if you change some code from &#8220;array($a, $b)&#8221; to &#8220;array(&#8216;a&#8217;=&gt;$a, &#8216;b&#8217;=&gt;$b)&#8221; you must rewrite other code (MVC example: rewrite code in controller =&gt; rewrite code in view). However, this is rare case.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Konstantin Mirin</title>
		<link>http://programmersnotes.info/2009/02/20/nice-trick-with-for-loop/comment-page-1/#comment-9</link>
		<dc:creator>Konstantin Mirin</dc:creator>
		<pubDate>Tue, 03 Mar 2009 08:05:04 +0000</pubDate>
		<guid isPermaLink="false">http://konstantin.takeforce.net/?p=8#comment-9</guid>
		<description>I can&#039;t understand how this trick refers to the application design and MVC pattern. Sure, I use both for and foreach loops - whichever is better for some specific case. And it is not related to controller or model in any way :)</description>
		<content:encoded><![CDATA[<p>I can&#8217;t understand how this trick refers to the application design and MVC pattern. Sure, I use both for and foreach loops &#8211; whichever is better for some specific case. And it is not related to controller or model in any way <img src='http://programmersnotes.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: creocoder</title>
		<link>http://programmersnotes.info/2009/02/20/nice-trick-with-for-loop/comment-page-1/#comment-8</link>
		<dc:creator>creocoder</dc:creator>
		<pubDate>Mon, 02 Mar 2009 00:16:33 +0000</pubDate>
		<guid isPermaLink="false">http://konstantin.takeforce.net/?p=8#comment-8</guid>
		<description>Konstantin, I don&#039;t understand you. Your comments are in contradiction with your ideology. On the one hand, &quot;I don’t like to work with Drupal or jQuery. I enjoy ExtJS, for example. And I wanted the same nicely designed PHP framework.&quot; - you write this in your post about Yii. When you perform some useful action in the body of the &quot;for&quot; loop, you get bad code design. And Performance is not a key here. It&#039;s better to write:
foreach (array(1,2,3,4,5) as $a) { echo $a; }

Something like http://kpumuk.info/php/crazy-php-world/</description>
		<content:encoded><![CDATA[<p>Konstantin, I don&#8217;t understand you. Your comments are in contradiction with your ideology. On the one hand, &#8220;I don’t like to work with Drupal or jQuery. I enjoy ExtJS, for example. And I wanted the same nicely designed PHP framework.&#8221; &#8211; you write this in your post about Yii. When you perform some useful action in the body of the &#8220;for&#8221; loop, you get bad code design. And Performance is not a key here. It&#8217;s better to write:<br />
foreach (array(1,2,3,4,5) as $a) { echo $a; }</p>
<p>Something like <a href="http://kpumuk.info/php/crazy-php-world/" rel="nofollow">http://kpumuk.info/php/crazy-php-world/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Konstantin Mirin</title>
		<link>http://programmersnotes.info/2009/02/20/nice-trick-with-for-loop/comment-page-1/#comment-7</link>
		<dc:creator>Konstantin Mirin</dc:creator>
		<pubDate>Sun, 01 Mar 2009 05:14:45 +0000</pubDate>
		<guid isPermaLink="false">http://konstantin.takeforce.net/?p=8#comment-7</guid>
		<description>Sure, it&#039;s OK, but see this: http://www.php.lt/benchmark/phpbench.php
Anyway, it&#039;s not recommendation to use for instead of foreach, just a little trick, that saves a line of code :)</description>
		<content:encoded><![CDATA[<p>Sure, it&#8217;s OK, but see this: <a href="http://www.php.lt/benchmark/phpbench.php" rel="nofollow">http://www.php.lt/benchmark/phpbench.php</a><br />
Anyway, it&#8217;s not recommendation to use for instead of foreach, just a little trick, that saves a line of code <img src='http://programmersnotes.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: creocoder</title>
		<link>http://programmersnotes.info/2009/02/20/nice-trick-with-for-loop/comment-page-1/#comment-6</link>
		<dc:creator>creocoder</dc:creator>
		<pubDate>Sat, 28 Feb 2009 23:39:38 +0000</pubDate>
		<guid isPermaLink="false">http://konstantin.takeforce.net/?p=8#comment-6</guid>
		<description>How about this:

$array = array(1,2,3,4,5);
foreach ($array as $a) {
  //do something clever here
  echo $a.&#039;&#039;;
}</description>
		<content:encoded><![CDATA[<p>How about this:</p>
<p>$array = array(1,2,3,4,5);<br />
foreach ($array as $a) {<br />
  //do something clever here<br />
  echo $a.&#8221;;<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

