<?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: The benefits of colon syntax for control structures</title>
	<atom:link href="http://www.codediesel.com/php/the-benefits-of-the-colon-syntax-for-control-structures/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codediesel.com/php/the-benefits-of-the-colon-syntax-for-control-structures/</link>
	<description>/* PHP &#38; MySQL Journal */</description>
	<lastBuildDate>Fri, 27 Jan 2012 16:39:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Chris London</title>
		<link>http://www.codediesel.com/php/the-benefits-of-the-colon-syntax-for-control-structures/comment-page-1/#comment-1859</link>
		<dc:creator>Chris London</dc:creator>
		<pubDate>Tue, 20 Apr 2010 16:01:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.codediesel.com/?p=150#comment-1859</guid>
		<description>Great article.  I&#039;ve also wondered about the performance affects of colon syntax over braces.  Anyone done benchmark testing?

There are other statements that can use the colon syntax.  All of them are: if, for, foreach, switch, and while.

Source: http://www.kwista.com/programming/colon-syntax-in-php/

Again I liked the article!</description>
		<content:encoded><![CDATA[<p>Great article.  I&#8217;ve also wondered about the performance affects of colon syntax over braces.  Anyone done benchmark testing?</p>
<p>There are other statements that can use the colon syntax.  All of them are: if, for, foreach, switch, and while.</p>
<p>Source: <a href="http://www.kwista.com/programming/colon-syntax-in-php/" rel="nofollow">http://www.kwista.com/programming/colon-syntax-in-php/</a></p>
<p>Again I liked the article!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sameer</title>
		<link>http://www.codediesel.com/php/the-benefits-of-the-colon-syntax-for-control-structures/comment-page-1/#comment-1126</link>
		<dc:creator>sameer</dc:creator>
		<pubDate>Tue, 17 Mar 2009 05:18:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.codediesel.com/?p=150#comment-1126</guid>
		<description>This was not an exercise in writing a sorting algorithm but just an example code to demonstrate the colon syntax.</description>
		<content:encoded><![CDATA[<p>This was not an exercise in writing a sorting algorithm but just an example code to demonstrate the colon syntax.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Thompson</title>
		<link>http://www.codediesel.com/php/the-benefits-of-the-colon-syntax-for-control-structures/comment-page-1/#comment-1122</link>
		<dc:creator>Andrew Thompson</dc:creator>
		<pubDate>Mon, 16 Mar 2009 20:30:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.codediesel.com/?p=150#comment-1122</guid>
		<description>Rather than using a different syntax or reducing the nesting, the above could be written:

$a = $array;
sort($a);
return $a == $array


Less code is better =)

Actually, I have no idea whether this&#039;ll be slower or not, as sort is done in c.</description>
		<content:encoded><![CDATA[<p>Rather than using a different syntax or reducing the nesting, the above could be written:</p>
<p>$a = $array;<br />
sort($a);<br />
return $a == $array</p>
<p>Less code is better =)</p>
<p>Actually, I have no idea whether this&#8217;ll be slower or not, as sort is done in c.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.codediesel.com/php/the-benefits-of-the-colon-syntax-for-control-structures/comment-page-1/#comment-1073</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Thu, 15 Jan 2009 22:17:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.codediesel.com/?p=150#comment-1073</guid>
		<description>I agree, some times using the colon syntax is good, especially when mixing HTML and PHP. I think you should have shown an example that mixed the two though!</description>
		<content:encoded><![CDATA[<p>I agree, some times using the colon syntax is good, especially when mixing HTML and PHP. I think you should have shown an example that mixed the two though!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jani Hartikainen</title>
		<link>http://www.codediesel.com/php/the-benefits-of-the-colon-syntax-for-control-structures/comment-page-1/#comment-1068</link>
		<dc:creator>Jani Hartikainen</dc:creator>
		<pubDate>Mon, 12 Jan 2009 13:19:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.codediesel.com/?p=150#comment-1068</guid>
		<description>By commenting the closing brace you basically repeat yourself. So you have an if, and you decide to change how it works - you have to also update the comment, or suddenly it doesn&#039;t make any sense at all. 

Don&#039;t like.</description>
		<content:encoded><![CDATA[<p>By commenting the closing brace you basically repeat yourself. So you have an if, and you decide to change how it works &#8211; you have to also update the comment, or suddenly it doesn&#8217;t make any sense at all. </p>
<p>Don&#8217;t like.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Sarsini</title>
		<link>http://www.codediesel.com/php/the-benefits-of-the-colon-syntax-for-control-structures/comment-page-1/#comment-1066</link>
		<dc:creator>Martin Sarsini</dc:creator>
		<pubDate>Mon, 12 Jan 2009 11:10:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.codediesel.com/?p=150#comment-1066</guid>
		<description>yes I like the idea of colon syntax structure, but what I like of my editor (jEdit) is that by selection an opening or closing curly braket and the editor pairs them together. I am sure with some modification it will work also with the colon syntax.
So what I do is to use the traditional brakets and always comment the opening and closing, like
} /* endif isset(var_name) */</description>
		<content:encoded><![CDATA[<p>yes I like the idea of colon syntax structure, but what I like of my editor (jEdit) is that by selection an opening or closing curly braket and the editor pairs them together. I am sure with some modification it will work also with the colon syntax.<br />
So what I do is to use the traditional brakets and always comment the opening and closing, like<br />
} /* endif isset(var_name) */</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jani Hartikainen</title>
		<link>http://www.codediesel.com/php/the-benefits-of-the-colon-syntax-for-control-structures/comment-page-1/#comment-1065</link>
		<dc:creator>Jani Hartikainen</dc:creator>
		<pubDate>Mon, 12 Jan 2009 11:07:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.codediesel.com/?p=150#comment-1065</guid>
		<description>I think rather than using different syntax, the above code could be written:

$i=0;
if(!is_array($array)) {
 return;
}

$total_elements = count($array);
 
while($total_elements &gt; 1) {
 if(!($array[$i] &lt; $array[$i+1])) {
  return false;
 }
 
 $i++;
 $total_elements--;
}

return true;


Less nesting is better =)</description>
		<content:encoded><![CDATA[<p>I think rather than using different syntax, the above code could be written:</p>
<p>$i=0;<br />
if(!is_array($array)) {<br />
 return;<br />
}</p>
<p>$total_elements = count($array);</p>
<p>while($total_elements &gt; 1) {<br />
 if(!($array[$i] &lt; $array[$i+1])) {<br />
  return false;<br />
 }</p>
<p> $i++;<br />
 $total_elements&#8211;;<br />
}</p>
<p>return true;</p>
<p>Less nesting is better =)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

