<?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; do</title>
	<atom:link href="http://www.phpmagicbook.com/tag/do/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>PHP Do While Loop</title>
		<link>http://www.phpmagicbook.com/php-do-while-loop/</link>
		<comments>http://www.phpmagicbook.com/php-do-while-loop/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 21:14:45 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Do Loop]]></category>
		<category><![CDATA[Do While Loop]]></category>
		<category><![CDATA[Loops]]></category>
		<category><![CDATA[PHP Basics]]></category>
		<category><![CDATA[basics]]></category>
		<category><![CDATA[do]]></category>
		<category><![CDATA[do while]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=160</guid>
		<description><![CDATA[A &#8220;do while&#8221; loop is a slightly modified version of the while loop. A do-while loop first do&#8217;s and secondly checks the while condition! PHP Do While Loop Structure - Define - Do - Print - Increment or decrement - Condition PHP Do While Loop Example &#60;?php $num = 1; do &#123; echo $num; $num [...]<p><a href="http://www.phpmagicbook.com/php-do-while-loop/">PHP Do While Loop</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>A &#8220;do while&#8221; loop is a slightly modified version of the <a href="http://www.phpmagicbook.com/php-while-loop/">while loop</a>. A do-while loop first do&#8217;s and secondly checks the while condition!</p>
<h4>PHP Do While Loop Structure</h4>
<p>- Define<br />
- Do<br />
- Print<br />
- Increment or decrement<br />
- Condition</p>
<p><span id="more-230"></span></p>
<h4>PHP Do While Loop Example</h4>

<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;">$num</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">do</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$num</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$num</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$num</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$num</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Output: 13579</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h4>Displaying the numbers from 1 to 10, with their squares</h4>

<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;">$count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">do</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$square</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$count</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$count</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$count</span> squared is <span style="color: #006699; font-weight: bold;">$square</span> &lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$count</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$count</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Output:</span>
<span style="color: #666666; font-style: italic;">// 1 squared is 1</span>
<span style="color: #666666; font-style: italic;">// 2 squared is 4</span>
<span style="color: #666666; font-style: italic;">// 3 squared is 9</span>
<span style="color: #666666; font-style: italic;">// 4 squared is 16</span>
<span style="color: #666666; font-style: italic;">// 5 squared is 25</span>
<span style="color: #666666; font-style: italic;">// 6 squared is 36</span>
<span style="color: #666666; font-style: italic;">// 7 squared is 49</span>
<span style="color: #666666; font-style: italic;">// 8 squared is 64</span>
<span style="color: #666666; font-style: italic;">// 9 squared is 81</span>
<span style="color: #666666; font-style: italic;">// 10 squared is 100</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href="http://www.phpmagicbook.com/php-do-while-loop/">PHP Do While Loop</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-each-loop/" title="PHP ForEach Loop">PHP ForEach Loop</a></li><li><a href="http://www.phpmagicbook.com/php-while-loop/" title="PHP While Loop">PHP While Loop</a></li><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/find-page-url-php/" title="Find Page URL With PHP &#8211; File Path">Find Page URL With PHP &#8211; File Path</a></li><li><a href="http://www.phpmagicbook.com/php-string-case-capitalization/" title="PHP &#8211; String Case &#8211; Capitalization">PHP &#8211; String Case &#8211; Capitalization</a></li><li><a href="http://www.phpmagicbook.com/php-post-and-get/" title="PHP Post And Get">PHP Post And Get</a></li><li><a href="http://www.phpmagicbook.com/get-data-as-an-array-download-php-example/" title="Get Data As An Array &#8211; Download PHP Example">Get Data As An Array &#8211; Download PHP Example</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-strings/" title="PHP Strings">PHP Strings</a></li><li><a href="http://www.phpmagicbook.com/local-and-glob-scope/" title="Local And Global Variable Scope in PHP">Local And Global Variable Scope in PHP</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/php-do-while-loop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
