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

					<description><![CDATA[<p>What is For each Loops? Use the for each loops to cycle through arrays. At each pass, the value of [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-for-each-loop/">Tutorial for &#8220;For each&#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 For each Loops?</h3>



<p class="wp-block-paragraph">Use the <code><span class="has-inline-color has-vivid-red-color"><strong>for each</strong></span></code> loops to cycle through arrays. At each pass, the value of the current array element is set to $value. In the next pass, the array pointer is moved one by one. The <strong><code><span class="has-inline-color has-vivid-red-color">for each</span></code></strong> loop is only used to loop around each key/values pair in an array. Only arrays are supported.</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">foreach ($array as $value) {
  code to be executed;
}</span></code></pre>



<p class="wp-block-paragraph"><strong>Here are some of the Foreach Loops:-</strong></p>



<ul class="wp-block-list"><li><strong>“foreach(…){…}”</strong> is the foreach php loop block code</li><li><strong>“$array_data”</strong> is the array variable to be looped through</li><li><strong>“$array_value “</strong> is the temporary variable that holds the current array item values.</li><li>“<strong>block of code</strong>…” is the piece of code that operates on the array values</li></ul>



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



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



<script src="https://gist.github.com/AdarshAshwani/526c51b5fccc8e63659f0388b250d957.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-46.png" alt=""/></figure></div>



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



<script src="https://gist.github.com/AdarshAshwani/a622128bd15bef37bfb48b6a466212b1.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-47.png" alt=""/></figure></div>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-for-each-loop/">Tutorial for &#8220;For each&#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-each-loop/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
