<?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 Magic Book - Free PHP Scripts, Tutorials and Downloads &#187; Elseif</title>
	<atom:link href="http://www.phpmagicbook.com/category/elseif/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpmagicbook.com</link>
	<description>PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips</description>
	<lastBuildDate>Tue, 15 Jun 2010 13:22:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>if elseif else Statements in PHP</title>
		<link>http://www.phpmagicbook.com/if-elseif-else/</link>
		<comments>http://www.phpmagicbook.com/if-elseif-else/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 19:51:24 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Elseif]]></category>
		<category><![CDATA[PHP Basics]]></category>
		<category><![CDATA[Conditions]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=153</guid>
		<description><![CDATA[To understand if, else if and else statements when we use these in the same script consider following example. &#60;?php $apples=&#34;2&#34;; if&#40;$apples=='3'&#41; &#123; echo &#34;Wrong&#34;; &#125; elseif&#40;$apples=='4'&#41; &#123; echo &#34;Wrong&#34;; &#125; else &#123; echo &#34;Correct&#34;; &#125; ?&#62; Output will be correct. If apples are 3 then print wrong. then if apples are 4 print wrong. [...]<p><a href="http://www.phpmagicbook.com/if-elseif-else/">if elseif else Statements in PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p>To understand if, else if and else statements when we use these in the same script consider following example.</p>
<p><span id="more-224"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$apples</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;2&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$apples</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'3'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Wrong&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$apples</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'4'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Wrong&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Correct&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Output will be correct.<br />
If apples are 3 then print wrong.<br />
then if apples are 4 print wrong.<br />
Otherwise print correct.<br />
Variables apples has a value of 2. Not 3 or 4.<br />
So the output is correct which is in else condition.</p>
<p><a href="http://www.phpmagicbook.com/if-elseif-else/">if elseif else Statements in PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/else-statement/" title="PHP Else Statement">PHP Else Statement</a></li><li><a href="http://www.phpmagicbook.com/if-statement/" title="PHP If Statement">PHP If Statement</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/if-elseif-else/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elseif Conditions in PHP</title>
		<link>http://www.phpmagicbook.com/elseif-conditions/</link>
		<comments>http://www.phpmagicbook.com/elseif-conditions/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 13:33:47 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Conditions]]></category>
		<category><![CDATA[Else]]></category>
		<category><![CDATA[Elseif]]></category>
		<category><![CDATA[PHP Basics]]></category>
		<category><![CDATA[if]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=140</guid>
		<description><![CDATA[This example is based on if elseif and else. It is as simple as telling script to do something if it finds A, If A is not present then look for B and if B is found then do something else. But if A and B are not found and there is something other then [...]<p><a href="http://www.phpmagicbook.com/elseif-conditions/">Elseif Conditions in PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p>This example is based on if elseif and else. It is as simple as telling script to do something if it finds A, If A  is not present then look for B and if B is found then do something else. But if A and B are not found and there is something other then do anything else for all other cases.</p>
<p>An if/else statement is great if you only need to check for one condition. However, what would you do if you wanted to check whether its a morning, evening or afternoon. Consider following example.</p>
<p><span id="more-211"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$hour</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;H&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$hour</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Good morning&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$hour</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">17</span><span style="color: #009900;">&#41;</span>
     <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Good afternoon&quot;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
     <span style="color: #b1b100;">else</span>
         <span style="color: #009900;">&#123;</span>
         <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Good evening&quot;</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href="http://www.phpmagicbook.com/elseif-conditions/">Elseif Conditions in PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/php-for-loop/" title="PHP For Loop">PHP For Loop</a></li><li><a href="http://www.phpmagicbook.com/upload-image-and-create-thumbnail/" title="Upload Image And Create Thumbnail Using PHP">Upload Image And Create Thumbnail Using PHP</a></li><li><a href="http://www.phpmagicbook.com/htaccess-essential-tricks-for-blog-website-performance-a-guide/" title=".htaccess Essential Tricks For Blog/Website Performance &#8211; Guide">.htaccess Essential Tricks For Blog/Website Performance &#8211; Guide</a></li><li><a href="http://www.phpmagicbook.com/upload-file-email-file-restrict/" title="Upload and eMail File Using PHP and Apply Restrictions">Upload and eMail File Using PHP and Apply Restrictions</a></li><li><a href="http://www.phpmagicbook.com/adding-record-in-database/" title="Adding Record In Database Using PHP">Adding Record In Database Using PHP</a></li><li><a href="http://www.phpmagicbook.com/iso-country-codes/" title="ISO Country Codes">ISO Country Codes</a></li><li><a href="http://www.phpmagicbook.com/php-strings/" title="PHP Strings">PHP Strings</a></li><li><a href="http://www.phpmagicbook.com/redirect-wordpress-rss-feeds-to-feedburner/" title="Redirect WordPress RSS Feeds to Feedburner">Redirect WordPress RSS Feeds to Feedburner</a></li><li><a href="http://www.phpmagicbook.com/php-arrays/" title="PHP Arrays">PHP Arrays</a></li><li><a href="http://www.phpmagicbook.com/php-search-via-google/" title="PHP Search Via Google">PHP Search Via Google</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/elseif-conditions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.727 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-07-30 16:31:17 -->
