<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Reference Book Blog &#187; equals sign</title>
	<atom:link href="http://www.phpreferencebook.com/tag/equals-sign/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpreferencebook.com</link>
	<description>PHP Reference: Beginner to Intermediate PHP5</description>
	<lastBuildDate>Thu, 29 Sep 2011 03:50:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Equal Sign in PHP: Equality and Not Equals</title>
		<link>http://www.phpreferencebook.com/samples/equal-sign-operators/</link>
		<comments>http://www.phpreferencebook.com/samples/equal-sign-operators/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 17:53:57 +0000</pubDate>
		<dc:creator>Mario Lurig</dc:creator>
				<category><![CDATA[Samples]]></category>
		<category><![CDATA[equals sign]]></category>

		<guid isPermaLink="false">http://www.phpreferencebook.com/?p=153</guid>
		<description><![CDATA[The PHP equal sign can be used to assign the value of variable as well as evaluate a variable as part of an if-else statement or other conditional statement. However, there are subtle differences that are important for ensuring your PHP code is as accurate as possible. The following samples are from page 22. The [...]]]></description>
			<content:encoded><![CDATA[<p>The PHP equal sign can be used to assign the value of variable as well as evaluate a variable as part of an if-else statement or other conditional statement. However, there are subtle differences that are important for ensuring your PHP code is as accurate as possible. The following samples are from page 22.</p>
<p style="background: #000000 none repeat scroll 0% 0%; margin-bottom: 0.07in;" lang="en-US"><span style="color: #ffffff;">The Equal Sign</span></p>
<p style="margin-bottom: 0.07in;" lang="en-US"><span style="color: #000000;"><span style="font-family: Palatino Linotype,serif;">Assignment ( = ): Assigns the value on the right to the variable on the left<br />
Equality ( == ): Checks if the left and right values are equal<br />
Identical ( === ): Checks if the left and right values are equal AND identical (same variable type)</span></span></p>
<p style="margin-bottom: 0.07in;" lang="en-US">
<p style="margin-bottom: 0.07in;" lang="en-US"><span style="color: #000000;"><span style="font-family: Palatino Linotype,serif;"><em>Example:</em></span></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Sets the value of $a as the integer 1</span>
<span style="color: #000088;">$b</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Sets the value of $b to the boolean TRUE</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'a is equal to b.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// compare VALUE and data type: if $a(integer) === $b(boolean)</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'a is identical and equal to b.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<pre style="background: #c0c0c0 none repeat scroll 0% 0%; margin-bottom: 0.07in; font-style: normal;" lang="en-US"><span style="color: #000000;"><span style="font-family: Courier New,monospace;">a is equal to b. </span></span></pre>
<p style="margin-bottom: 0.07in; font-style: normal;" lang="en-US">
<p style="background: #000000 none repeat scroll 0% 0%; margin-bottom: 0.07in;" lang="en-US"><span style="color: #ffffff;">Not ( ! ), Not Equal to ( != ), Not Identical to ( !== )</span></p>
<p style="margin-bottom: 0.07in;"><span style="color: #000000;"><span style="font-family: Palatino Linotype,serif;"><span lang="en-US">Used in conditional statements to evaluate as true a FALSE result of an </span></span></span><span style="color: #000000;"><span style="font-family: Palatino Linotype,serif;"><span lang="en-US"><em>expression</em></span></span></span><span style="color: #000000;"><span style="font-family: Palatino Linotype,serif;"><span lang="en-US"><span style="font-style: normal;"> or if a value is NOT equal to the second value.</span></span></span></span></p>
<p style="margin-bottom: 0.07in;" lang="en-US"><span style="color: #000000;"><span style="font-family: Palatino Linotype,serif;"><em>Example:</em></span></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// If the variable $a is NOT set then...</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'$a is not set'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// The expression is TRUE if it is NOT set</span>
<span style="color: #666666; font-style: italic;">// Since there is no ELSE statement, nothing is displayed</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'$a does not equal zero'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<pre style="background: #c0c0c0 none repeat scroll 0% 0%; margin-bottom: 0.07in; font-style: normal;" lang="en-US"><span style="color: #000000;"><span style="font-family: Courier New,monospace;">$a does not equal zero</span></span></pre>
<p style="margin-bottom: 0.07in;"><span style="color: #000000;"><span style="font-family: Palatino Linotype,serif;"><span lang="en-US"><em></em></span></span></span></p>
<p style="margin-bottom: 0.07in; font-style: normal;" lang="en-US">
]]></content:encoded>
			<wfw:commentRss>http://www.phpreferencebook.com/samples/equal-sign-operators/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

