<?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/tag/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.1</generator>
		<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/isset-function/" title="isset Function in PHP &#8211; Check for any Variable if it is Set or Not in PHP">isset Function in PHP &#8211; Check for any Variable if it is Set or Not in PHP</a></li><li><a href="http://www.phpmagicbook.com/daily-changing-content-or-link-throughout-month/" title="Daily Changing Content Or Link Throughout Month">Daily Changing Content Or Link Throughout Month</a></li><li><a href="http://www.phpmagicbook.com/php-file-delete-unlink-function/" title="PHP &#8211; File Delete &#8211; Unlink Function">PHP &#8211; File Delete &#8211; Unlink Function</a></li><li><a href="http://www.phpmagicbook.com/quiz-switch-if-else/" title="Quiz &#8211; Switch &#8211; If Else in PHP">Quiz &#8211; Switch &#8211; If Else in PHP</a></li><li><a href="http://www.phpmagicbook.com/upload-max-filesize-large-file-uploads/" title="Upload Max Filesize &#8211; Large File Uploads in PHP">Upload Max Filesize &#8211; Large File Uploads in PHP</a></li><li><a href="http://www.phpmagicbook.com/random-single-image-onload/" title="Random Single Image Onload Using PHP">Random Single Image Onload Using PHP</a></li><li><a href="http://www.phpmagicbook.com/browser-check-with-php/" title="Browser Check With PHP">Browser Check With PHP</a></li><li><a href="http://www.phpmagicbook.com/php-file-append/" title="PHP &#8211; File Append">PHP &#8211; File Append</a></li><li><a href="http://www.phpmagicbook.com/phone-number-email-validation/" title="Phone Number And Email Validation Update">Phone Number And Email Validation Update</a></li><li><a href="http://www.phpmagicbook.com/speed-up-your-php-application-with-adodb-database-abstraction-library/" title="Speed Up Your PHP Application with ADOdb Database Abstraction Library">Speed Up Your PHP Application with ADOdb Database Abstraction Library</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/elseif-conditions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
