<?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 loops Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/php-loops/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/php-loops/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 31 Jul 2021 12:57:27 +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>Tutorial for &#8220;For&#8221; loop</title>
		<link>https://www.scmgalaxy.com/tutorials/tutorial-for-for-loop/</link>
					<comments>https://www.scmgalaxy.com/tutorials/tutorial-for-for-loop/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Sat, 31 Jul 2021 12:57:25 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[For loop]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[php loops]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Tutorial for For loop]]></category>
		<category><![CDATA[Tutorials for PHP Loops]]></category>
		<category><![CDATA[What]]></category>
		<category><![CDATA[What is For Loops]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7235</guid>

					<description><![CDATA[<p>What is For Loops? The For loop is a control structure that repeatedly executes a block of code until a condition is [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-for-loop/">Tutorial for &#8220;For&#8221; loop</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">What is <strong>For</strong> Loops?</h3>



<p class="wp-block-paragraph">The For loop is a control structure that repeatedly executes a block of code until a condition is met. It&#8217;s commonly used to make a code block repeat itself a set number of times. It should be used if the number of iterations is given; otherwise, a while loop should be used. You use for loop when you already know how many times you want to run a block of code. It permits users to centralize all comments concerning the loop.</p>



<p class="wp-block-paragraph"><strong>Syntax:-</strong></p>



<pre class="wp-block-code"><code><span class="has-inline-color has-vivid-red-color">for (init counter; test counter; increment counter) {
  code to be executed for each iteration;
}</span></code></pre>



<p class="wp-block-paragraph"><strong>The for loop in PHP is similar to the for loop in Java/C/C++. The following are the definitions of the (for loop) parameters:</strong></p>



<ul class="wp-block-list"><li><span class="has-inline-color has-vivid-red-color"><strong><code>initialization</code></strong> </span>–It is used to set the counter variables and checked before the body of the loop is executed once unconditionally.</li><li><strong><code><span class="has-inline-color has-vivid-red-color">condition</span></code></strong> – At the beginning of each repetition, the state is assessed. The loop remains if it is true and the nesting statements are performed. If it is wrong, the loop is finished.</li><li><span class="has-inline-color has-vivid-red-color"><strong><code>increment</code></strong> </span>– The loop counter adds a new value. It is assessed at the end of every iteration.</li></ul>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="https://static.javatpoint.com/phppages/images/forloop.png" alt="php for loop flowchart"/></figure></div>



<p class="wp-block-paragraph"><strong>Example1:-</strong></p>



<script src="https://gist.github.com/AdarshAshwani/ef2515e85f190bab1029a1040b58da9f.js"></script>



<p class="wp-block-paragraph"><strong>Output:-</strong></p>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="https://www.devopsschool.com/blog/wp-content/uploads/2021/05/image-44.png" alt=""/></figure></div>



<p class="wp-block-paragraph"><strong>Example2:-</strong></p>



<script src="https://gist.github.com/AdarshAshwani/85a675415b8d04b4bb3c8d8ce078261d.js"></script>



<p class="wp-block-paragraph"><strong>Output:-</strong></p>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="https://www.devopsschool.com/blog/wp-content/uploads/2021/05/image-45.png" alt=""/></figure></div>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-for-loop/">Tutorial for &#8220;For&#8221; loop</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/tutorial-for-for-loop/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Tutorial for Do.. While loop</title>
		<link>https://www.scmgalaxy.com/tutorials/tutorial-for-do-while-loop/</link>
					<comments>https://www.scmgalaxy.com/tutorials/tutorial-for-do-while-loop/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Thu, 29 Jul 2021 14:06:46 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[do while]]></category>
		<category><![CDATA[do while loop]]></category>
		<category><![CDATA[loops]]></category>
		<category><![CDATA[loops in PHP]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[php do while loop]]></category>
		<category><![CDATA[php loops]]></category>
		<category><![CDATA[Tutorial for Do While loop]]></category>
		<category><![CDATA[Tutorial for Do.. While loop]]></category>
		<category><![CDATA[Tutorials for PHP Loops]]></category>
		<category><![CDATA[What]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7193</guid>

					<description><![CDATA[<p>What is Do….While Loops? The (do-while loop) is a version of the while loop in which the state is assessed [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-do-while-loop/">Tutorial for Do.. While loop</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">What is Do….While Loops?</h3>



<p class="wp-block-paragraph">The (<code><strong><span class="has-inline-color has-vivid-red-color">do-while</span></strong></code> loop) is a version of the while loop in which the state is assessed at the end of each loop iteration. A (<code><span class="has-inline-color has-vivid-red-color"><strong>while</strong></span></code> loop) runs a block of code once and then evaluates the condition; if the condition is true, the expression is repeated as long as the condition is true.</p>



<p class="wp-block-paragraph"><strong>Syntax:-</strong></p>



<pre class="wp-block-code"><code><code><span class="has-inline-color has-vivid-red-color">do {
  code to be executed;
} while (condition is true);</span></code></code></pre>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="https://www.guru99.com/images/2013/04/do_while_loop.png" alt="PHP Loop and  Control Structures"/></figure></div>



<p class="wp-block-paragraph"><strong>Example:-</strong> </p>



<script src="https://gist.github.com/AdarshAshwani/e7391590c1516560bf3a9b5c87ef8716.js"></script>



<p class="wp-block-paragraph"><strong>Output:-</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://www.devopsschool.com/blog/wp-content/uploads/2021/05/image-43.png" alt=""/></figure>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-do-while-loop/">Tutorial for Do.. While loop</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/tutorial-for-do-while-loop/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Tutorials for PHP Loops</title>
		<link>https://www.scmgalaxy.com/tutorials/tutorials-for-php-loops/</link>
					<comments>https://www.scmgalaxy.com/tutorials/tutorials-for-php-loops/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Thu, 29 Jul 2021 13:09:05 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Different types of Loops]]></category>
		<category><![CDATA[How]]></category>
		<category><![CDATA[How to use loops in PHP]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[loops in PHP]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[php loops]]></category>
		<category><![CDATA[Tutorials for PHP Loops]]></category>
		<category><![CDATA[types of Loops]]></category>
		<category><![CDATA[use loops in PHP]]></category>
		<category><![CDATA[Use of Loops]]></category>
		<category><![CDATA[What]]></category>
		<category><![CDATA[What is Loop]]></category>
		<category><![CDATA[Why]]></category>
		<category><![CDATA[Why to Use Loops]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7176</guid>

					<description><![CDATA[<p>What is Loop? A loop is an Iterative Control Structure that requires the same number of codes to be executed [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorials-for-php-loops/">Tutorials for PHP Loops</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">What is Loop?</h3>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="https://slideplayer.com/4972949/16/images/slide_1.jpg" alt="A loop is a repetition control structure. it causes a single statement or  block to be executed repeatedly What is a loop? - ppt download"/></figure></div>



<p class="wp-block-paragraph">A loop is an Iterative Control Structure that requires the same number of codes to be executed several times until a specific condition is met. When writing code, you may want a specific block of code to run a certain number of times. As a result, rather than applying nearly similar code lines to a script, we can employ loops.</p>



<h3 class="wp-block-heading">What are the Different types of Loops?</h3>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="https://www.devopsschool.com/blog/wp-content/uploads/2020/07/images.png" alt="PHP 7 Fundamental Tutorial for Beginners - PHP Loop - DevOpsSchool.com"/></figure></div>



<p class="wp-block-paragraph">Loops are used repeatedly to run the same piece of code as long as a given condition is met. A loop&#8217;s basic premise is to simplify recurring procedures in a programmer in order to save time and effort. PHP supports four different loop styles.</p>



<ul class="wp-block-list"><li><span class="has-inline-color has-vivid-red-color"><code><strong>while</strong></code> </span>– Loops through a code block as long as the given condition is true.</li><li><span class="has-inline-color has-vivid-red-color"><code><strong>do...while</strong></code> </span>– The code block running once and then is tested. State. If the condition is true, the declaration shall be repeated until the condition stated is true.</li><li><span class="has-inline-color has-vivid-red-color"><strong><code>for</code></strong> </span>– Loops via a code block before a given number is reached in the counter.</li><li><span class="has-inline-color has-vivid-red-color"><strong><code>foreach</code></strong> </span>– Loops for each unit of an array across a block of code.</li></ul>



<h3 class="wp-block-heading">Why to Use Loops?</h3>



<p class="wp-block-paragraph">When trying to recreate code, it might be tedious to retype or copy and paste the same code over and over again. Worse, unintentional mistakes might lead to programme malfunctions.</p>



<p class="wp-block-paragraph">That&#8217;s quite a few keystrokes! What if you decide later that you want to start each statement with “The count is currently: ”? You&#8217;d have to copy it and paste it into every single line.</p>



<p class="wp-block-paragraph">Fortunately, loops are a function in most programming languages that allows you to automatically repeat code before such requirements are met. Iteration is a phrase used to describe the repetition of code, and it refers to each time the code is executed. Loops will reduce the number of lines of code you write while still allowing you to update it later.</p>



<p class="wp-block-paragraph">PHP is no exception, as it offers a variety of ways to repeat the execution of a code block.</p>



<p class="wp-block-paragraph">This Article has cover the following PHP loop types:</p>



<ul class="wp-block-list"><li><strong><span class="has-inline-color has-vivid-red-color"><code>while</code></span></strong></li><li><strong><span class="has-inline-color has-vivid-red-color"><code>do</code> … <code>while</code></span></strong></li><li><strong><span class="has-inline-color has-vivid-red-color"><code>for</code></span></strong></li><li><strong><span class="has-inline-color has-vivid-red-color"><code>foreach</code></span></strong></li></ul>



<p class="wp-block-paragraph">There are conditions in each of these loops that prevent the loop from executing. If these requirements are not met, an endless loop will follow, and the software will never be able to quit executing the code block.</p>



<h3 class="wp-block-heading">How to use loops in PHP?</h3>



<p class="wp-block-paragraph">In order to write effective code, any programmer needs have a thorough understanding of loops and how to use them effectively in programming.</p>



<p class="wp-block-paragraph">When writing code, we must always repeat a same set of functions. Performing them one at a time would result in a higher number of lines of code and a longer duration. As a result, the software gets more difficult to understand. As a result, instead of using loops to run the code, we can use them!</p>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorials-for-php-loops/">Tutorials for PHP Loops</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/tutorials-for-php-loops/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
