<?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>difference between break and continue in php - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/difference-between-break-and-continue-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/difference-between-break-and-continue-in-php/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Thu, 04 Aug 2022 07:01:21 +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>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>difference between break and continue in php - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/difference-between-break-and-continue-in-php/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is the purpose of break and continue statement ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-is-the-purpose-of-break-and-continue-statement/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-is-the-purpose-of-break-and-continue-statement/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Thu, 04 Aug 2022 07:01:21 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[break and continue statement in c]]></category>
		<category><![CDATA[break and continue statement in php]]></category>
		<category><![CDATA[difference between break and continue in c]]></category>
		<category><![CDATA[difference between break and continue in php]]></category>
		<category><![CDATA[difference between break and continue in python]]></category>
		<category><![CDATA[difference between break and continue statement]]></category>
		<category><![CDATA[difference between break and continue statement in php]]></category>
		<category><![CDATA[explain break and continue statement in c]]></category>
		<category><![CDATA[what is break statement in c]]></category>
		<category><![CDATA[what is break statement in php]]></category>
		<category><![CDATA[what is the purpose of break and continue statement]]></category>
		<category><![CDATA[what is the purpose of break and continue statement in php]]></category>
		<category><![CDATA[what is the purpose of using break and continue statements]]></category>
		<category><![CDATA[what is the significance of break and continue statements]]></category>
		<category><![CDATA[what is the use of break and continue statement]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4585</guid>

					<description><![CDATA[PHP also has two keywords break and continue to control the loop, just like another programming language. Those statements are known as the flow of transfer or jumping statements in the program. Break The break statement is used inside the for loop, foreach loop, while loop and do-while loop and then switch case statement. Inside [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul style="text-align: justify;">
<li>PHP also has two keywords break and continue to control the loop, just like another programming language.</li>
<li>Those statements are known as the flow of transfer or jumping statements in the program.</li>
</ul>
<h2 id="break" style="text-align: justify;">Break</h2>
<p style="text-align: center;"><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4586" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement.png" alt="" width="991" height="797" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement.png 991w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-300x241.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-768x618.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-390x314.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-820x659.png 820w" sizes="(max-width: 991px) 100vw, 991px" /></p>
<ul style="text-align: justify;">
<li>The break statement is used inside the for loop, foreach loop, while loop and do-while loop and then switch case statement.</li>
<li>Inside a loop the break statement encountered then it immediately terminated the loop statement and transferred the control to the next statement, followed by a loop to resume the execution.</li>
<li>In nested loop statement it is also used, where it breaks the inner loop first and then proceed to break the outer loop.</li>
<li>In program it is also used in the switch case statement to terminate a particular case’s execution.</li>
<li>A break statement is placed inside the loop with a condition and then if the condition is true, a break statement is immediately executed to break the execution of the loop and to move the control to the next statement followed by the loop.</li>
</ul>
<h2 id="sample-code" style="text-align: justify;">Sample Code</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-php code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-php code-embed-code">&lt;?php    <br/><br/>// defines the for loop   <br/><br/>for ($a = 0; $a &lt; 10; $a++) {  <br/><br/>  if ($a == 7) {  <br/><br/>    break; /* Break the loop when condition is true. */  <br/><br/>  }  <br/><br/>  echo &quot;Number: $a &lt;br&gt;&quot;;  <br/><br/>}  <br/><br/>echo &quot; Terminate the loop at $a number&quot;;  <br/><br/>?&gt;  </code></pre> </div>
<h2 id="output" style="text-align: justify;">Output</h2>
<p><img decoding="async" class="alignnone size-full wp-image-4587 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-output.png" alt="" width="1341" height="542" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-output.png 1341w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-output-300x121.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-output-1024x414.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-output-768x310.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-output-390x158.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-output-820x331.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/break-statement-output-1180x477.png 1180w" sizes="(max-width: 1341px) 100vw, 1341px" /></p>
<h2 id="continue" style="text-align: justify;">Continue</h2>
<p style="text-align: center;"><img decoding="async" class="alignnone size-full wp-image-4588" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement.png" alt="" width="861" height="802" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement.png 861w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-300x279.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-768x715.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-390x363.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-820x764.png 820w" sizes="(max-width: 861px) 100vw, 861px" /></p>
<ul style="text-align: justify;">
<li>It is used in the middle of for loop, while loop, do-while loop and for-each loop.</li>
<li>In a loop the continue statement is encountered then it skips the current iteration of the loop.</li>
<li>A continue statement is usually used with a condition inside a loop and then if the condition is true, the continue statement is executed to skip the iteration.</li>
<li>It transfers the control to the beginning of the loop for further execution inside the loop, after that.</li>
</ul>
<h2 id="sample-code-2" style="text-align: justify;">Sample Code</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-php code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-php code-embed-code">&lt;?php    <br/><br/>// defines the for loop   <br/><br/>for ($a = 0; $a &lt; 7; $a++) {  <br/><br/>  if ($a == 5) {  <br/><br/>  echo &quot; Skipped number is $a &lt;br&gt;&quot;; // prints the skipped number.  <br/><br/>    continue; /* It skips the defined statement if the condition is true. */  <br/><br/>  <br/><br/>  }  <br/><br/>  echo &quot;Number is: $a &lt;br&gt;&quot;;  <br/><br/>}  <br/><br/>?&gt;</code></pre> </div>
<h2 id="output-2" style="text-align: justify;"> Output</h2>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4589" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-output.png" alt="" width="1329" height="477" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-output.png 1329w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-output-300x108.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-output-1024x368.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-output-768x276.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-output-390x140.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-output-820x294.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/continue-statement-output-1180x424.png 1180w" sizes="(max-width: 1329px) 100vw, 1329px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-is-the-purpose-of-break-and-continue-statement/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
