<?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"
	>
<channel>
	<title>Comments on: Logical and Precedence</title>
	<atom:link href="http://crschmidt.net/blog/102/logical-and-precedence/feed/" rel="self" type="application/rss+xml" />
	<link>http://crschmidt.net/blog/102/logical-and-precedence/</link>
	<description>Ramblings of a GIS Hacker</description>
	<pubDate>Tue, 18 Nov 2008 10:06:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Timwi</title>
		<link>http://crschmidt.net/blog/102/logical-and-precedence/#comment-4034</link>
		<dc:creator>Timwi</dc:creator>
		<pubDate>Tue, 25 Oct 2005 10:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://crschmidt.net/blog/archives/102/logical-and-precedence/#comment-4034</guid>
		<description>Now I'm somewhat surprised about this. As much as I hate disagreeing with an anti-PHP statement, but:&lt;ul&gt;&lt;li&gt;I can't believe you would &lt;i&gt;want&lt;/i&gt; for "&lt;code&gt;$var = $test &#124;&#124; $default;&lt;/code&gt;" to do the assignment first. That runs contrary to intuitive expectation as well as C/C++/C#/Java/everything else.&lt;/li&gt;&lt;li&gt;I'm surprised you ask "Who thought this was a smart idea?" when the answer is probably Larry Wall. The "two &lt;code&gt;AND&lt;/code&gt;/&lt;code&gt;OR&lt;/code&gt; operators with different precendence" idea comes from Perl, and PHP has copied it. PHP may have messed up other precedences (I wouldn't be surprised), but the statement that &lt;code&gt;=&lt;/code&gt; has a higher precendence than &lt;code&gt;or&lt;/code&gt; but a lower precendence than &lt;code&gt;&#124;&#124;&lt;/code&gt; applies both to PHP and to Perl.&lt;/li&gt;&lt;/ul&gt;</description>
		<content:encoded><![CDATA[<p>Now I&#8217;m somewhat surprised about this. As much as I hate disagreeing with an anti-PHP statement, but:
<ul>
<li>I can&#8217;t believe you would <i>want</i> for &#8220;<code>$var = $test || $default;</code>&#8221; to do the assignment first. That runs contrary to intuitive expectation as well as C/C++/C#/Java/everything else.</li>
<li>I&#8217;m surprised you ask &#8220;Who thought this was a smart idea?&#8221; when the answer is probably Larry Wall. The &#8220;two <code>AND</code>/<code>OR</code> operators with different precendence&#8221; idea comes from Perl, and PHP has copied it. PHP may have messed up other precedences (I wouldn&#8217;t be surprised), but the statement that <code>=</code> has a higher precendence than <code>or</code> but a lower precendence than <code>||</code> applies both to PHP and to Perl.</li>
</ul>
]]></content:encoded>
	</item>
</channel>
</rss>
