<?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: Stupid PHP Tricks: (true == false)</title>
	<atom:link href="http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/</link>
	<description>Look! Bunnies!</description>
	<lastBuildDate>Tue, 02 Mar 2010 14:50:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Webspace Creations</title>
		<link>http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/comment-page-1/#comment-26432</link>
		<dc:creator>Webspace Creations</dc:creator>
		<pubDate>Wed, 23 Dec 2009 17:09:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=172#comment-26432</guid>
		<description>When something as basic as comparisons do not function as expected, this is a serious problem and it is a problem that hackers are exploiting RIGHT NOW. Programmers aren&#039;t lazy, they want a consistent programming environment. Many are coming from strict languages like C/C++. An expression like (&#039;1a&#039; == 1) should not evaluate as true. Loose typing would mean that (&#039;1&#039; == 1) evaluates as true, but PHP tries too hard to make an expression work and the === convention is an oddity (meaning any programmer with real experience is going to be unfamiliar with it). Weak typing is fine, but fundamental operations, such as comparisons, should work in a consistent and predictable way if we&#039;re going to get serious about building secure web apps.</description>
		<content:encoded><![CDATA[<p>When something as basic as comparisons do not function as expected, this is a serious problem and it is a problem that hackers are exploiting RIGHT NOW. Programmers aren&#8217;t lazy, they want a consistent programming environment. Many are coming from strict languages like C/C++. An expression like (&#8216;1a&#8217; == 1) should not evaluate as true. Loose typing would mean that (&#8216;1&#8242; == 1) evaluates as true, but PHP tries too hard to make an expression work and the === convention is an oddity (meaning any programmer with real experience is going to be unfamiliar with it). Weak typing is fine, but fundamental operations, such as comparisons, should work in a consistent and predictable way if we&#8217;re going to get serious about building secure web apps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pbean</title>
		<link>http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/comment-page-1/#comment-26108</link>
		<dc:creator>pbean</dc:creator>
		<pubDate>Thu, 19 Nov 2009 21:21:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=172#comment-26108</guid>
		<description>=== to the rescue... I have been using it more and more. But in my opinion the whole language is a mess and should get a big overhaul. Just have a look at these different kinds of constructs which can, in some situations, do the same or worse have completely unexpected behavior:

if (isset($a)) ...
if (is_null($a)) ...
if ($a == null) ...
if ($a === null) ...
if ($a) ...
if (!!$a) ...</description>
		<content:encoded><![CDATA[<p>=== to the rescue&#8230; I have been using it more and more. But in my opinion the whole language is a mess and should get a big overhaul. Just have a look at these different kinds of constructs which can, in some situations, do the same or worse have completely unexpected behavior:</p>
<p>if (isset($a)) &#8230;<br />
if (is_null($a)) &#8230;<br />
if ($a == null) &#8230;<br />
if ($a === null) &#8230;<br />
if ($a) &#8230;<br />
if (!!$a) &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sava</title>
		<link>http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/comment-page-1/#comment-25521</link>
		<dc:creator>Sava</dc:creator>
		<pubDate>Tue, 01 Sep 2009 07:45:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=172#comment-25521</guid>
		<description>Probably because 00 = 0 ? :D</description>
		<content:encoded><![CDATA[<p>Probably because 00 = 0 ? :D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Javi</title>
		<link>http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/comment-page-1/#comment-24765</link>
		<dc:creator>Javi</dc:creator>
		<pubDate>Thu, 23 Apr 2009 09:02:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=172#comment-24765</guid>
		<description>I searched Google for php &quot;true == false&quot; and found your post.

The reason was, today I ran into the same example as you did. But in my case, I think it&#039;s even funnier/more stupid.

Just assign $a = &#039;00&#039; and $b = &#039;0&#039;. The same conditions apply to these values, and the universe is broken again.

Why in the world do two different strings evaluate to be the same? Who knows.</description>
		<content:encoded><![CDATA[<p>I searched Google for php &#8220;true == false&#8221; and found your post.</p>
<p>The reason was, today I ran into the same example as you did. But in my case, I think it&#8217;s even funnier/more stupid.</p>
<p>Just assign $a = &#8216;00&#8242; and $b = &#8216;0&#8242;. The same conditions apply to these values, and the universe is broken again.</p>
<p>Why in the world do two different strings evaluate to be the same? Who knows.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Lawrie</title>
		<link>http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/comment-page-1/#comment-5030</link>
		<dc:creator>James Lawrie</dc:creator>
		<pubDate>Fri, 19 Dec 2008 11:54:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=172#comment-5030</guid>
		<description>Nick - this doesn&#039;t make PHP a weakly typed language any more than having the symptoms of influenza gives you the flu. PHP *is* weakly typed (it&#039;s often referred to as duck-typed - if it quacks like a duck, it&#039;s probably a duck) - this is just a symptom of that.
Maybe you are inferring that the word &quot;weakly&quot; infers this is a bad thing, whereas it doesn&#039;t, it&#039;s just the name for this kind of typing.</description>
		<content:encoded><![CDATA[<p>Nick &#8211; this doesn&#8217;t make PHP a weakly typed language any more than having the symptoms of influenza gives you the flu. PHP *is* weakly typed (it&#8217;s often referred to as duck-typed &#8211; if it quacks like a duck, it&#8217;s probably a duck) &#8211; this is just a symptom of that.<br />
Maybe you are inferring that the word &#8220;weakly&#8221; infers this is a bad thing, whereas it doesn&#8217;t, it&#8217;s just the name for this kind of typing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Link Flood - 09/11/2008 &#124; 1337hax0r.com</title>
		<link>http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/comment-page-1/#comment-4972</link>
		<dc:creator>Link Flood - 09/11/2008 &#124; 1337hax0r.com</dc:creator>
		<pubDate>Mon, 08 Dec 2008 20:53:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=172#comment-4972</guid>
		<description>[...] (true == false)? Apparently it does in PHP. [...]</description>
		<content:encoded><![CDATA[<p>[...] (true == false)? Apparently it does in PHP. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick &#124; Resource Pile</title>
		<link>http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/comment-page-1/#comment-4738</link>
		<dc:creator>Nick &#124; Resource Pile</dc:creator>
		<pubDate>Mon, 29 Sep 2008 13:29:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=172#comment-4738</guid>
		<description>Nice, but I wouldn&#039;t go as far to say this makes php a weakly typed language. It&#039;s a good thing. Yes, you can do the above, but the aim of such a language is to create things, so the easier it is to create them (while remaining fast and relatively-low on code), the better the language in my eyes.</description>
		<content:encoded><![CDATA[<p>Nice, but I wouldn&#8217;t go as far to say this makes php a weakly typed language. It&#8217;s a good thing. Yes, you can do the above, but the aim of such a language is to create things, so the easier it is to create them (while remaining fast and relatively-low on code), the better the language in my eyes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Mackey</title>
		<link>http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/comment-page-1/#comment-4636</link>
		<dc:creator>David Mackey</dc:creator>
		<pubDate>Tue, 09 Sep 2008 20:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=172#comment-4636</guid>
		<description>Nice article. :) Stumbled on ya.</description>
		<content:encoded><![CDATA[<p>Nice article. :) Stumbled on ya.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/comment-page-1/#comment-4634</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Mon, 08 Sep 2008 11:04:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=172#comment-4634</guid>
		<description>... that is why we have strict comparisons with === and !==</description>
		<content:encoded><![CDATA[<p>&#8230; that is why we have strict comparisons with === and !==</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oliver Ong</title>
		<link>http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/comment-page-1/#comment-4527</link>
		<dc:creator>Oliver Ong</dc:creator>
		<pubDate>Mon, 25 Aug 2008 14:10:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=172#comment-4527</guid>
		<description>CPP, um i would rather use php to do websites than use c/c++ or even asm. lets see who finishes creating a db add edit and delete transaction first.</description>
		<content:encoded><![CDATA[<p>CPP, um i would rather use php to do websites than use c/c++ or even asm. lets see who finishes creating a db add edit and delete transaction first.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
