<?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>phpsyntax Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/phpsyntax/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/phpsyntax/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Wed, 13 Apr 2022 16:33:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>What is Loop What are the Syntax?</title>
		<link>https://www.scmgalaxy.com/tutorials/what-is-loop-what-are-the-syntax/</link>
					<comments>https://www.scmgalaxy.com/tutorials/what-is-loop-what-are-the-syntax/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Thu, 24 Jun 2021 15:31:48 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[php framework]]></category>
		<category><![CDATA[phpsyntax]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=6567</guid>

					<description><![CDATA[<p>In this turorial i’m going to learn about Lools, how to use and how to write. What is loop? A [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/what-is-loop-what-are-the-syntax/">What is Loop What are the Syntax?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph" id="0fab">In this turorial i’m going to learn about Lools, how to use and how to write.</p>



<p class="wp-block-paragraph" id="0a31">What is loop?</p>



<p class="wp-block-paragraph" id="1195">A Loop is an Iterative Control Structure that involves executing the same number of code a whatever you write in the codition its used to execute the same block code again to again whenever its condition is false.</p>



<p class="wp-block-paragraph" id="01f6">Syntax:-</p>



<pre class="wp-block-preformatted">while(condition){<br>    // Code to be executed<br>}</pre>



<p class="wp-block-paragraph" id="1266">EX:-</p>



<pre class="wp-block-preformatted">&lt;?php    <br>for($n=1;$n&lt;=10;$n++){    <br>echo "$n&lt;br/&gt;";    <br>}    <br>?&gt;</pre>



<p class="wp-block-paragraph" id="982f"><strong>Result:</strong></p>



<pre class="wp-block-preformatted">1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10</pre>



<p class="wp-block-paragraph" id="b115"><strong>When to use while loops</strong></p>



<ul class="wp-block-list"><li>While loops are used to execute a block of code until a certain condition becomes true.</li><li>You can use a while loop to read records returned from a database query.</li></ul>



<p class="wp-block-paragraph" id="663c"><strong>Types of while loops</strong></p>



<ul class="wp-block-list"><li><strong>Do… while</strong>&nbsp;— executes the block of code at least once before evaluating the condition</li><li><strong>While…</strong>&nbsp;— checks the condition first. If it evaluates to true, the block of code is executed as long as the condition is true. If it evaluates to false, the execution of the while loop is terminated.</li></ul>



<p class="wp-block-paragraph" id="ce1b">The Do while loop is similar to&nbsp;the while loop with one important difference. The body of do while loop is executed at least once. Only then, the test expression is excuted.</p>



<pre class="wp-block-preformatted">do<br>{<br>   // the body of the loop<br>}<br>while (testExpression);</pre>



<p class="wp-block-paragraph" id="7468">Exmple: &#8211;</p>



<pre class="wp-block-preformatted">&lt;?php<br>$x = 1;<br><br>do {<br>  echo "The number is: $x &lt;br&gt;";<br>  $x++;<br>} while ($x &lt;= 5);<br>?&gt;</pre>



<p class="wp-block-paragraph" id="f0f1">Outputs:-</p>



<pre class="wp-block-preformatted">The number is: 1<br>The number is: 2<br>The number is: 3<br>The number is: 4<br>The number is: 5</pre>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/what-is-loop-what-are-the-syntax/">What is Loop What are the Syntax?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/what-is-loop-what-are-the-syntax/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
