<?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>For-each loop Archives - Artificial Intelligence</title>
	<atom:link href="https://www.aiuniverse.xyz/tag/for-each-loop/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.aiuniverse.xyz/tag/for-each-loop/</link>
	<description>Exploring the universe of Intelligence</description>
	<lastBuildDate>Sat, 22 Apr 2023 12:34:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>What is PHP Iterative Statements and how many types of Iterative statements:</title>
		<link>https://www.aiuniverse.xyz/what-is-php-iterative-statements-and-how-many-types-of-iterative-statements/</link>
					<comments>https://www.aiuniverse.xyz/what-is-php-iterative-statements-and-how-many-types-of-iterative-statements/#respond</comments>
		
		<dc:creator><![CDATA[Maruti Kr.]]></dc:creator>
		<pubDate>Sat, 22 Apr 2023 12:34:48 +0000</pubDate>
				<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[do-while Loop]]></category>
		<category><![CDATA[for Loop]]></category>
		<category><![CDATA[For-each loop]]></category>
		<category><![CDATA[What is PHP Iterative Statements and how many types of Iterative statements]]></category>
		<category><![CDATA[while Loop]]></category>
		<guid isPermaLink="false">https://www.aiuniverse.xyz/?p=16557</guid>

					<description><![CDATA[<p>PHP Iterative Statements, also known as loops, are used to execute a block of code repeatedly as long as a specified condition is true. PHP supports four <a class="read-more-link" href="https://www.aiuniverse.xyz/what-is-php-iterative-statements-and-how-many-types-of-iterative-statements/">Read More</a></p>
<p>The post <a href="https://www.aiuniverse.xyz/what-is-php-iterative-statements-and-how-many-types-of-iterative-statements/">What is PHP Iterative Statements and how many types of Iterative statements:</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>PHP Iterative Statements, also known as loops, are used to execute a block of code repeatedly as long as a specified condition is true. PHP supports four types of iterative statements:</p>



<ol class="wp-block-list">
<li>while Loop</li>



<li>do-while Loop</li>



<li>for Loop</li>



<li>foreach loop</li>
</ol>



<h2 class="wp-block-heading">while Loop:</h2>



<p>The while loop is used when you want to execute a block of code as long as a specified condition is true. The show is given follow chat </p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="576" src="https://www.aiuniverse.xyz/wp-content/uploads/2023/04/wl-1024x576.webp" alt="" class="wp-image-16558" srcset="https://www.aiuniverse.xyz/wp-content/uploads/2023/04/wl-1024x576.webp 1024w, https://www.aiuniverse.xyz/wp-content/uploads/2023/04/wl-300x169.webp 300w, https://www.aiuniverse.xyz/wp-content/uploads/2023/04/wl-768x432.webp 768w, https://www.aiuniverse.xyz/wp-content/uploads/2023/04/wl.webp 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p><strong>Syntax:</strong> </p>



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



<p><strong>Example:</strong></p>



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



<h2 class="wp-block-heading">do-while Loop:</h2>



<p>The do-while loop is similar to the while loop, but the block of code is executed at least once, regardless of whether the condition is true or false.</p>



<p><strong>Syntax:</strong></p>



<pre class="wp-block-code"><code>do {
  // code to be executed
} while (condition);</code></pre>



<p><strong> Example:</strong></p>



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



<h2 class="wp-block-heading">for Loop:</h2>



<p>The for loop is used when you know exactly how many times you want to execute a block of code. It has a counter variable that is incremented or decremented with each iteration.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="300" height="330" src="https://www.aiuniverse.xyz/wp-content/uploads/2023/04/dow.png" alt="" class="wp-image-16559" srcset="https://www.aiuniverse.xyz/wp-content/uploads/2023/04/dow.png 300w, https://www.aiuniverse.xyz/wp-content/uploads/2023/04/dow-273x300.png 273w" sizes="(max-width: 300px) 100vw, 300px" /></figure>



<p><strong>Syntax:</strong></p>



<pre class="wp-block-code"><code>for (initialization; condition; increment/decrement) 
{
  // code to be executed
}</code></pre>



<p><strong>Example:</strong> </p>



<pre class="wp-block-code"><code>&lt;?php
for ($x = 0; $x &lt;= 10; $x++) {
  echo "The number is: $x &lt;br>";
}
?></code></pre>



<h2 class="wp-block-heading">For-each loop:</h2>



<p>The foreach loop is used to loop through arrays and objects. It iterates over each element in the array or each property in the object.</p>



<p>Syntax: </p>



<pre class="wp-block-code"><code>foreach ($array as $value) 
{
  // code to be executed
}</code></pre>



<p><strong>Example:</strong></p>



<pre class="wp-block-code"><code>&lt;?php
echo "Welcome to the world of foreach loops &lt;br>";
$arr = array("Bananas", "Apples", "Harpic", "Bread", "Butter");
foreach ($arr as  $value) {
    echo "$value &lt;br>";
}
?></code></pre>
<p>The post <a href="https://www.aiuniverse.xyz/what-is-php-iterative-statements-and-how-many-types-of-iterative-statements/">What is PHP Iterative Statements and how many types of Iterative statements:</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aiuniverse.xyz/what-is-php-iterative-statements-and-how-many-types-of-iterative-statements/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
