<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sat, 25 May 2013 16:01:04 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Ask About PHP: PHP's alternative syntax and why it's useful]]></title>
      <guid>http://www.phpdeveloper.org/news/12353</guid>
      <link>http://www.phpdeveloper.org/news/12353</link>
      <description><![CDATA[<p>
On the "Ask About PHP" blog today there's <a href="http://www.askaboutphp.com/beginners/59/phps-alternative-syntax-and-why-its-useful.html">a new post</a> looking at some of the alternative syntaxes that PHP has to offer for control structures.
</p>
<blockquote>
PHP offers an alternative way to write their control structures for as long as I've remembered. It basically does away with the curly brackets and replaces the opening curly with a colon (:) and the closing with '˜end'-whatever. I have to be honest and say I've never really found a need to use the alternative syntax, simply because I'm so used to using the curly braces after so many years of using PHP. Plus, it's less typing!
</blockquote>
<p>
The one specifically mentioned deals with "if" evaluations. There's two other options to the usual braces method - one being a shorthand using colons and a semicolon and the other using the <a href="http://php.net/ternary">ternary syntax</a>.
</p>]]></description>
      <pubDate>Thu, 16 Apr 2009 07:50:56 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sameer Borate's Blog: The benefits of colon syntax for control structures]]></title>
      <guid>http://www.phpdeveloper.org/news/11744</guid>
      <link>http://www.phpdeveloper.org/news/11744</link>
      <description><![CDATA[<p>
In <a href="http://www.codediesel.com/php/the-benefits-of-the-colon-syntax-for-control-structures/">this recent post</a> to his CodeDiesel.com blog, <i>Sameer</i> is promoting the use of colons in control structures over curly braces.
</p>
<blockquote>
PHP offers a alternative syntax for some of its control structures- if, while, for, foreach, and switch, where you change the opening brace to a colon (:) and the closing brace to endif;, endwhile;, endfor;, endforeach;, or endswitch;, respectively. [...] With the colon syntax you just have to match a '˜if' with a '˜endif' or a '˜for' with a '˜endfor'. When you are mixing HTML with PHP in web pages the code can become quite dense and confusing if it uses a lot of braces.
</blockquote>
<p>
An <a href="http://www.codediesel.com/php/the-benefits-of-the-colon-syntax-for-control-structures/">example</a> is included showing its use in "if" and "white" statements. With most editors and IDEs supporting brace matching and code folding, this is less of an issue, but it can help make for cleaner code.
</p>]]></description>
      <pubDate>Thu, 15 Jan 2009 08:48:33 -0600</pubDate>
    </item>
  </channel>
</rss>
