<?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 - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/category/php/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Thu, 04 Aug 2022 07:25:05 +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>PHP - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/category/php/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is the difference between session and cookies ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-is-the-difference-between-session-and-cookies/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-is-the-difference-between-session-and-cookies/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Thu, 04 Aug 2022 07:25:05 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[difference between a cookie and a session]]></category>
		<category><![CDATA[difference between cookie and session]]></category>
		<category><![CDATA[Difference between Session and Cookies]]></category>
		<category><![CDATA[difference between session and cookies in php]]></category>
		<category><![CDATA[difference between session and cookies php]]></category>
		<category><![CDATA[select correct statement regarding session and cookies]]></category>
		<category><![CDATA[session and cookies in servlet]]></category>
		<category><![CDATA[session vs cookie vs local storage]]></category>
		<category><![CDATA[Session vs cookies]]></category>
		<category><![CDATA[what are the difference between sessions and cookies]]></category>
		<category><![CDATA[what is session and cookies explain in detail with an example]]></category>
		<category><![CDATA[What is the difference between session and cookies ?]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4594</guid>

					<description><![CDATA[                         Session                       Cookies A temporary and interactive information interchange between two or more communicating devices or between a user and computer Small pieces of data sent from a website and stored on the user’s computer by the user’s web browser while the user is browsing &#160; Stored in the server [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4595 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/session-vs-cookies.png" alt="" width="600" height="439" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/session-vs-cookies.png 600w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/session-vs-cookies-300x220.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/session-vs-cookies-390x285.png 390w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<table width="0">
<tbody>
<tr>
<td width="309"><strong> </strong></p>
<p><strong>        </strong></p>
<p><strong>               Session  </strong></td>
<td width="309"><strong> </strong></p>
<p><strong> </strong></p>
<p><strong>                 Cookies</strong></td>
</tr>
<tr>
<td width="309">A temporary and interactive information interchange between two or more communicating devices or between a user and computer</td>
<td width="309">Small pieces of data sent from a website and stored on the user’s computer by the user’s web browser while the user is browsing</td>
</tr>
<tr>
<td width="309">&nbsp;</p>
<p>Stored in the server side</td>
<td width="309">&nbsp;</p>
<p>Stored in the client’s browser as text files</td>
</tr>
<tr>
<td width="309">&nbsp;</p>
<p>It can store a large amount of data</td>
<td width="309">&nbsp;</p>
<p>It can store a minimum amount of data</td>
</tr>
<tr>
<td width="309">&nbsp;</p>
<p>It provides more security because it is difficult to access session values</td>
<td width="309">&nbsp;</p>
<p>It provides minimum security because it is easier to access cookie values</td>
</tr>
<tr>
<td width="309">&nbsp;</p>
<p>It holds multiple variables</td>
<td width="309">&nbsp;</p>
<p>It does not hold multiple variables</td>
</tr>
<tr>
<td width="309">&nbsp;</p>
<p>It is available until the browser is opened</td>
<td width="309">&nbsp;</p>
<p>It keeps the information until deleted by the user or set as per the timer</td>
</tr>
<tr>
<td width="309">&nbsp;</p>
<p>More reliable</td>
<td width="309">&nbsp;</p>
<p>Comparatively less reliable</td>
</tr>
<tr>
<td width="309">&nbsp;</p>
<p>Using session_destroy (), we will destroy sessions</td>
<td width="309">&nbsp;</p>
<p>Setting the cookie time to expire the cookie</td>
</tr>
<tr>
<td width="309">&nbsp;</p>
<p>Session depends on the cookie</td>
<td width="309">&nbsp;</p>
<p>Cookies does not depends on the cookie</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-is-the-difference-between-session-and-cookies/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is Zend Engine and Zend Server in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-is-zend-engine-and-zend-server-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-is-zend-engine-and-zend-server-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Thu, 04 Aug 2022 07:12:37 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[what is zend engine]]></category>
		<category><![CDATA[what is zend engine in php]]></category>
		<category><![CDATA[zend certified engineer list]]></category>
		<category><![CDATA[zend engine]]></category>
		<category><![CDATA[zend engine in php]]></category>
		<category><![CDATA[zend engine vs zend framework]]></category>
		<category><![CDATA[zend server]]></category>
		<category><![CDATA[zend server community edition]]></category>
		<category><![CDATA[zend server php 8]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4591</guid>

					<description><![CDATA[As a compiler and runtime engine, Zend engine is used internally by PHP. PHP Scripts are loaded into memory and compiled into Zend opcodes then the HTML generated is sent to the client and opcodes are executed. It is an open-source scripting engine, commonly known it plays an important role in the web automation language [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">As a compiler and runtime engine, Zend engine is used internally by PHP.</li>
<li style="text-align: justify;">PHP Scripts are loaded into memory and compiled into Zend opcodes then the HTML generated is sent to the client and opcodes are executed.</li>
<li style="text-align: justify;">It is an open-source scripting engine, commonly known it plays an important role in the web automation language PHP.</li>
<li style="text-align: justify;">It provides resource and memory management and other standard services for the PHP language.</li>
<li style="text-align: justify;">Its performance, extensibility, and reliability have played a significant role in PHP’s increasing popularity.</li>
<li style="text-align: justify;">Zend Server is an official server of a local web application, then it enables us to deploy, debug, and prepare your production processes.</li>
<li style="text-align: justify;">It handles clustering, hosting, file distribution, and file transfers when we install it on the server.</li>
<li style="text-align: justify;">Along with updating existing code via an object-oriented interface, the code generator makes it possible to create new code.</li>
</ul>
<p><img decoding="async" class="alignnone size-full wp-image-4592 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/zend-engine.png" alt="" width="933" height="805" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/zend-engine.png 933w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/zend-engine-300x259.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/zend-engine-768x663.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/zend-engine-390x336.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/zend-engine-820x708.png 820w" sizes="(max-width: 933px) 100vw, 933px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-is-zend-engine-and-zend-server-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<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 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 loading="lazy" 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 loading="lazy" 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>
		<item>
		<title>What is the use of count () function in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-is-the-use-of-count-function-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-is-the-use-of-count-function-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Thu, 04 Aug 2022 06:46:30 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[array count]]></category>
		<category><![CDATA[array_count_values in php]]></category>
		<category><![CDATA[count() function in php]]></category>
		<category><![CDATA[count() function in php mysql]]></category>
		<category><![CDATA[how to count all elements in an array in php]]></category>
		<category><![CDATA[php array count example]]></category>
		<category><![CDATA[php count with condition]]></category>
		<category><![CDATA[php count() function]]></category>
		<category><![CDATA[php count() function with examples]]></category>
		<category><![CDATA[what is the use of count function in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4582</guid>

					<description><![CDATA[In PHP this unbuilt function is used to count the current elements in the array. If it has been set to an empty array, whether the function might return 0 for the variable and the variable that is not set the function returns 0. Generally, this function takes one parameter, the array for which the [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">In PHP this unbuilt function is used to count the current elements in the array.</li>
<li style="text-align: justify;">If it has been set to an empty array, whether the function might return 0 for the variable and the variable that is not set the function returns 0.</li>
<li style="text-align: justify;">Generally, this function takes one parameter, the array for which the elements need to be counted.</li>
<li style="text-align: justify;">The function an take a parameter <i>mode which</i> tells the function to count the element in recursive or normal mode but in addition.</li>
<li style="text-align: justify;">In Count () syntax $array is mandatory and in which elements are needed to be counted.</li>
<li style="text-align: justify;">In Count () mode is optional which is used to set the mode of function and their parameter can take two possible values, either 0 or 1. 1 generally indicates to count of the values of the array recursively.</li>
<li style="text-align: justify;">In an array, the functions return the number of elements.</li>
</ul>
<h2 id="syntax" style="text-align: justify;">Syntax</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">Count ($array, mode)</code></pre> </div>
<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;!DOCTYPE html&gt;<br/>  &lt;html&gt;<br/>   &lt;body&gt;<br/><br/>     &lt;?php<br/>       $cars=array(&quot;Volvo&quot;,&quot;Volkswagen&quot;,&quot;Hyundai&quot;,&quot;Ferrari&quot;);<br/>       echo count($cars);<br/>       ?&gt;<br/><br/>   &lt;/body&gt;<br/>&lt;/html&gt;</code></pre> </div>
<h2 id="output" style="text-align: justify;">Output</h2>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4583" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/count-function-in-php.png" alt="" width="1118" height="208" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/count-function-in-php.png 1118w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/count-function-in-php-300x56.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/count-function-in-php-1024x191.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/count-function-in-php-768x143.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/count-function-in-php-390x73.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/count-function-in-php-820x153.png 820w" sizes="(max-width: 1118px) 100vw, 1118px" /></p>
<p style="text-align: justify;">
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-is-the-use-of-count-function-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is the difference between GET and POST Method ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-is-the-difference-between-get-and-post-method/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-is-the-difference-between-get-and-post-method/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Thu, 04 Aug 2022 06:33:30 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[difference between get and post in rest api]]></category>
		<category><![CDATA[difference between get and post method in html with example]]></category>
		<category><![CDATA[get and post method difference in java]]></category>
		<category><![CDATA[get and post method example]]></category>
		<category><![CDATA[get and post method in java]]></category>
		<category><![CDATA[get and post method in php]]></category>
		<category><![CDATA[get method]]></category>
		<category><![CDATA[what is the difference between get and post method]]></category>
		<category><![CDATA[what is the difference between get and post method in html]]></category>
		<category><![CDATA[what is the difference between get and post method in java]]></category>
		<category><![CDATA[what is the difference between get and post method in javascript]]></category>
		<category><![CDATA[what is the difference between get and post method in php]]></category>
		<category><![CDATA[what is the difference between get and post method in rest api]]></category>
		<category><![CDATA[what is the difference between get and post method in web api]]></category>
		<category><![CDATA[what is the difference between get and post method mcq]]></category>
		<category><![CDATA[what is the difference between get and post methods in html discuss]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4576</guid>

					<description><![CDATA[                        GET                          POST In browser history parameters remain because they are the part of the URL In browser history parameters remain because they are the part of the URL It can be bookmarked It cannot be bookmarked If the HTML is stored in the browser cache, GET requests are re-executed but may [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4578 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-post-method.png" alt="" width="956" height="526" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-post-method.png 956w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-post-method-300x165.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-post-method-768x423.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-post-method-390x215.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-post-method-820x451.png 820w" sizes="(max-width: 956px) 100vw, 956px" /></p>
<table width="0">
<tbody>
<tr>
<td width="335"><strong> </strong></p>
<p><strong>                      GET </strong></td>
<td width="335"><strong> </strong></p>
<p><strong>                       POST</strong></td>
</tr>
<tr>
<td width="335">In browser history parameters remain because they are the part of the URL</td>
<td width="335">In browser history parameters remain because they are the part of the URL</td>
</tr>
<tr>
<td width="335">It can be bookmarked</td>
<td width="335">It cannot be bookmarked</td>
</tr>
<tr>
<td width="335">If the HTML is stored in the browser cache, GET requests are re-executed but may not be re-submitted to server</p>
<p>&nbsp;</td>
<td width="335">The browser alerts the user that data will need to be re-submitted</td>
</tr>
<tr>
<td width="335">It can send but the parameter data is limited to what we can stuff into the URL</td>
<td width="335">It can send parameters, including uploading files to the server</td>
</tr>
<tr>
<td width="335">Hacking becomes easier for script kiddies</td>
<td width="335">Hacking becomes more difficult</td>
</tr>
<tr>
<td width="335">There is restriction on form data type, only ASCII characters allowed</td>
<td width="335">There is no restrictions. Binary data is also allowed</td>
</tr>
<tr>
<td width="335"><a href="https://www.wikitechy.com/php/php-get">PHP GET</a> method is less secure than POST because data sent is part of the URL. So, its saved in browser history or server logs in plaintext</td>
<td width="335"><a href="https://www.wikitechy.com/php/php-post">PHP POST</a> is little safer than GET because the parameters are not stored in browser history or web- server logs</td>
</tr>
<tr>
<td width="335">There are restrictions on form data length</td>
<td width="335">There are no restrictions on form data length</td>
</tr>
<tr>
<td width="335">GET method should not be used while sending passwords or other sensitive information</td>
<td width="335">POST method used when sending passwords or other sensitive information.</td>
</tr>
<tr>
<td width="335">GET method is visible to everyone in address bar and it has limits on amount of information to send</td>
<td width="335">POST method variables are not displayed in the URL</td>
</tr>
<tr>
<td width="335">It can be cached</td>
<td width="335">It cannot be cached</td>
</tr>
</tbody>
</table>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4577 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-method.gif" alt="" width="1920" height="1080" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-is-the-difference-between-get-and-post-method/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What does the unlink () function and unset () function mean ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-does-the-unlink-function-and-unset-function-mean/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-does-the-unlink-function-and-unset-function-mean/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Thu, 04 Aug 2022 05:46:18 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[difference between unlink and unset in php]]></category>
		<category><![CDATA[php unlink file if exists]]></category>
		<category><![CDATA[php unlink not working]]></category>
		<category><![CDATA[unlink image in php]]></category>
		<category><![CDATA[unlink in php with path]]></category>
		<category><![CDATA[what is unlink in php]]></category>
		<category><![CDATA[what is use of header function]]></category>
		<category><![CDATA[what is use of header function in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4572</guid>

					<description><![CDATA[The unlink () and unset () functions are used to do some undo operations but used in different situations because both acts differently. unlink () function In PHP unlink () function is used when you want to delete the files completely and it is an inbuilt function. In this the filename of the file which [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">The unlink () and unset () functions are used to do some undo operations but used in different situations because both acts differently.</li>
</ul>
<h2 id="unlink-function" style="text-align: justify;">unlink () function</h2>
<ul style="text-align: justify;">
<li>In PHP unlink () function is used when you want to delete the files completely and it is an inbuilt function.</li>
<li>In this the filename of the file which has to be deleted is sent as a parameter and True on success and False on failure when the function returns.</li>
<li>The unlink () function accepts two parameters in PHP they are filename and context.</li>
<li>The filename is a mandatory parameter which specifies the filename of the file which has to be deleted.</li>
<li>The context is an optional parameter which specifies the context of the file handle which can be used to modify the nature of the stream.</li>
<li>Suppose there is a file named <strong>‘gfg.txt’, </strong>it returns True on success and False on failure.</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/>// PHP program to delete a file named gfg.txt<br/>// using unlink() function<br/> <br/>$file_pointer = fopen(&#039;gfg.txt&#039;);<br/> <br/>// Writing on a file named gfg.txt<br/>fwrite($file_pointer, &#039;A computer science portal for Wikitechy!&#039;);<br/>fclose($file_pointer);<br/> <br/>// Using unlink() function to delete a file<br/>unlink(&#039;gfg.txt&#039;);<br/> <br/>?&gt;</code></pre> </div>
<h2 id="output" style="text-align: justify;">Output</h2>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4573" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unlink-function.png" alt="" width="1041" height="169" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unlink-function.png 1041w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unlink-function-300x49.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unlink-function-1024x166.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unlink-function-768x125.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unlink-function-390x63.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unlink-function-820x133.png 820w" sizes="(max-width: 1041px) 100vw, 1041px" /></p>
<h2 id="unset-function" style="text-align: justify;">unset () function</h2>
<ul style="text-align: justify;">
<li>The unset () function is used when you want to make that file empty and it is an inbuilt function which is used to remove the content from the file by emptying it in PHP.</li>
<li>Thereby making it empty, the unset () function not only clears the file content but also is used to unset a variable.</li>
<li>It means that the function clears the content of a file rather deleting it.</li>
<li>This function accepts single parameter <strong>variable </strong>which is required and it does not return any value.</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/>$var = &quot;hello&quot;;<br/>         <br/>// Change would be reflected outside the function <br/>function unset_value() {<br/>    unset($GLOBALS[&#039;var&#039;]);<br/>}<br/>         <br/>unset_value();<br/>echo $var;<br/>?&gt;</code></pre> </div>
<h2 id="output-2" style="text-align: justify;">Output</h2>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4574" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unset-function.png" alt="" width="1037" height="187" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unset-function.png 1037w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unset-function-300x54.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unset-function-1024x185.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unset-function-768x138.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unset-function-390x70.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/unset-function-820x148.png 820w" sizes="(max-width: 1037px) 100vw, 1037px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-does-the-unlink-function-and-unset-function-mean/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is session in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-is-session-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-is-session-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Wed, 03 Aug 2022 12:37:58 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[how to get data from session in php]]></category>
		<category><![CDATA[how to set session in php]]></category>
		<category><![CDATA[php session login]]></category>
		<category><![CDATA[session and cookies in php]]></category>
		<category><![CDATA[session start in php]]></category>
		<category><![CDATA[session variable in php]]></category>
		<category><![CDATA[what is difference between session and cookies in php]]></category>
		<category><![CDATA[what is session and cookies in php]]></category>
		<category><![CDATA[what is session id in php]]></category>
		<category><![CDATA[what is session in php]]></category>
		<category><![CDATA[what is session in php how it works]]></category>
		<category><![CDATA[what is session start in php]]></category>
		<category><![CDATA[what is session_destroy in php]]></category>
		<category><![CDATA[what is the default session time in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4568</guid>

					<description><![CDATA[PHP session is used to store and pass information from one page to another page temporarily until the user closes website. In shopping website PHP website is widely used where we need to store and pass cart information from one page to another. For example. username, product code, product name, product price etc. The session [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">PHP session is used to store and pass information from one page to another page temporarily until the user closes website.</li>
<li style="text-align: justify;">In shopping website PHP website is widely used where we need to store and pass cart information from one page to another.</li>
<li style="text-align: justify;">For example. username, product code, product name, product price etc.</li>
<li style="text-align: justify;">The session creates unique user id for each browser to recognize the user and avoid conflict between multiple browsers.</li>
<li style="text-align: justify;">PHP session_start () function is used to start the session and starts new and resume existing session.</li>
<li style="text-align: justify;">If session is created already then it returns existing session and if session is not available, it returns and creates new session.</li>
<li style="text-align: justify;">It is an associative array that contains all session variables and it is used to get and set session variables.</li>
</ul>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4569 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session.png" alt="" width="1209" height="727" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session.png 1209w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-300x180.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-1024x616.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-768x462.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-390x235.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-820x493.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-1180x710.png 1180w" sizes="(max-width: 1209px) 100vw, 1209px" /></p>
<h2 id="syntax">Syntax</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/>           session_start();<br/>  <br/>            ?&gt;</code></pre> </div>
<h2 id="sample-code">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/>                 session_start();<br/>                ?&gt;<br/>              &lt;!DOCTYPE html&gt;<br/>              &lt;html&gt;<br/>              &lt;body&gt;<br/><br/>              &lt;?php<br/>               // Echo session variables that were set on previous page<br/>                 echo &quot;Favorite color is &quot; . $_SESSION[&quot;favcolor&quot;] . &quot;.&lt;br&gt;&quot;;<br/>                 echo &quot;Favorite animal is &quot; . $_SESSION[&quot;favanimal&quot;] . &quot;.&quot;;<br/>              ?&gt;<br/><br/>            &lt;/body&gt;<br/>            &lt;/html&gt;</code></pre> </div>
<h2 id="output">Output</h2>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4570" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-example.png" alt="" width="1290" height="549" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-example.png 1290w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-example-300x128.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-example-1024x436.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-example-768x327.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-example-390x166.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-example-820x349.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/php-session-example-1180x502.png 1180w" sizes="(max-width: 1290px) 100vw, 1290px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-is-session-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What are the ways to define a constant in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-are-the-ways-to-define-a-constant-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-are-the-ways-to-define-a-constant-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Wed, 03 Aug 2022 12:03:36 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[how to define constants in php]]></category>
		<category><![CDATA[how to use constants in php]]></category>
		<category><![CDATA[magic constants in php]]></category>
		<category><![CDATA[php constant case-insensitive]]></category>
		<category><![CDATA[php constants]]></category>
		<category><![CDATA[php constants array]]></category>
		<category><![CDATA[php constants in class]]></category>
		<category><![CDATA[php constants types]]></category>
		<category><![CDATA[php protected static const]]></category>
		<category><![CDATA[php unset constant]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4564</guid>

					<description><![CDATA[PHP constants are identifier or name that can&#8217;t be changed during the execution of the script except for magic constants, which are not really constants. Constants can never be undefined or changed, they are similar to the variable except once defined. PHP constants follow the same PHP variable rules and it remains constant across the [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li><a href="https://www.wikitechy.com/php/php-constants">PHP constants</a> are identifier or name that can&#8217;t be changed during the execution of the script except for magic constants, which are not really constants.</li>
<li>Constants can never be undefined or changed, they are similar to the variable except once defined.</li>
<li>PHP constants follow the same PHP variable rules and it remains constant across the entire program.</li>
<li>Conventionally, in uppercase letters PHP constants should be defined and it can be started with an underscore or letter only.</li>
<li>PHP constants consists of two types, they are:
<ul>
<li>Using define () function</li>
<li>Using const keyword</li>
</ul>
</li>
</ul>
<h2 id="using-define-function">Using define () function</h2>
<ul>
<li>In PHP use the define () function to create a constant and it defines constant at run time.</li>
<li>In this function name specifies the constant name, value specifies the constant value and case-insensitive specifies whether a constant is case-insensitive.</li>
<li>By default, if value is false it means it is case sensitive.</li>
</ul>
<h3 id="sample-code">Sample Code</h3>
<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/>define(&quot;MESSAGE&quot;,&quot;Welcome to Wikitechy&quot;,true);//not case sensitive    <br/>echo MESSAGE, &quot;&lt;/br&gt;&quot;;    <br/>echo message;    <br/>?&gt;    </code></pre> </div>
<h3 id="output">Output</h3>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4565" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/define-function.png" alt="" width="1229" height="309" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/define-function.png 1229w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/define-function-300x75.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/define-function-1024x257.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/define-function-768x193.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/define-function-390x98.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/define-function-820x206.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/define-function-1180x297.png 1180w" sizes="(max-width: 1229px) 100vw, 1229px" /></p>
<h2 id="using-const-keyword">Using const Keyword</h2>
<ul>
<li>PHP introduces a const keyword to create a constant and it defines constants at compile time.</li>
<li>It constructs a language, not a function.</li>
<li>The constant defined using const keyword are <strong>case-sensitive</strong>.</li>
</ul>
<h3 id="sample-code-2">Sample Code</h3>
<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/>    define(&quot;MSG&quot;, &quot;Wikitechy&quot;);  <br/>    echo MSG, &quot;&lt;/br&gt;&quot;;  <br/>    echo constant(&quot;MSG&quot;);  <br/>    //both are similar  <br/>?&gt;  </code></pre> </div>
<h3 id="output-2">Output</h3>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4566 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/const-keyword.png" alt="" width="1230" height="290" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/const-keyword.png 1230w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/const-keyword-300x71.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/const-keyword-1024x241.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/const-keyword-768x181.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/const-keyword-390x92.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/const-keyword-820x193.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/const-keyword-1180x278.png 1180w" sizes="(max-width: 1230px) 100vw, 1230px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-are-the-ways-to-define-a-constant-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is echo and print in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-is-echo-and-print-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-is-echo-and-print-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Tue, 02 Aug 2022 12:35:01 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[difference between echo and print in php]]></category>
		<category><![CDATA[echo and print difference in php]]></category>
		<category><![CDATA[echo and print in php]]></category>
		<category><![CDATA[echo php in html]]></category>
		<category><![CDATA[example of echo and print in php]]></category>
		<category><![CDATA[php echo variable]]></category>
		<category><![CDATA[php echo variable in html]]></category>
		<category><![CDATA[php print array]]></category>
		<category><![CDATA[php print to console]]></category>
		<category><![CDATA[what are the differences between echo and print in php]]></category>
		<category><![CDATA[what is difference between echo and print_r in php]]></category>
		<category><![CDATA[what is echo and print in php]]></category>
		<category><![CDATA[what is print in php]]></category>
		<category><![CDATA[why echo is faster than print in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4560</guid>

					<description><![CDATA[PHP is not a function; it is a language construct and its output become one or more string. If you want to pass more than one parameter to echo, the use of parentheses is required. PHP echo statement is used to print the string, array, variable multi-line strings, escaping characters, etc. Echo is used to [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">PHP is not a function; it is a language construct and its output become one or more string.</li>
<li style="text-align: justify;">If you want to pass more than one parameter to echo, the use of parentheses is required.</li>
<li style="text-align: justify;"><a href="https://www.wikitechy.com/php/php-echo">PHP echo statement</a> is used to print the string, array, variable multi-line strings, escaping characters, etc.</li>
<li style="text-align: justify;">Echo is used to display the output, because it is a statement and does not return any value.</li>
<li style="text-align: justify;">Echo can be used with echo () or without parentheses echo.</li>
<li style="text-align: justify;">In echo, we can pass multiple strings separated by a comma (,).</li>
<li style="text-align: justify;">The <a href="https://www.wikitechy.com/php/php-print">PHP print</a> can be used alternative to echo many times and its statement is similar to the echo statement.</li>
<li style="text-align: justify;">In PHP print accepts one argument at a time &amp; cannot be used as a variable function.</li>
<li style="text-align: justify;">Echo is faster than the print statement and print outputs only the strings.</li>
<li style="text-align: justify;">The main difference between the echo and print statement is that echo does not behave like function whereas print behave like a function.</li>
</ul>
<h2 id="sample-code-echo-statement">Sample Code : Echo Statement</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;!DOCTYPE html&gt;<br/>&lt;html&gt;<br/>&lt;body&gt;<br/><br/>&lt;?php<br/>echo &quot;&lt;h2&gt;PHP is Fun!&lt;/h2&gt;&quot;;<br/>echo &quot;Welcome to wikitechy!&lt;br&gt;&quot;;<br/>echo &quot;I&#039;m about to learn PHP!&lt;br&gt;&quot;;<br/>echo &quot;This &quot;, &quot;string &quot;, &quot;was &quot;, &quot;made &quot;, &quot;with multiple parameters.&quot;;<br/>?&gt; <br/><br/>&lt;/body&gt;<br/>&lt;/html&gt;</code></pre> </div>
<h2 id="output">Output<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4561" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/echo-statement.png" alt="" width="1295" height="596" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/echo-statement.png 1295w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/echo-statement-300x138.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/echo-statement-1024x471.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/echo-statement-768x353.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/echo-statement-390x179.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/echo-statement-820x377.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/echo-statement-1180x543.png 1180w" sizes="(max-width: 1295px) 100vw, 1295px" /></h2>
<h2 id="sample-code-print-statement">Sample Code: Print Statement</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;!DOCTYPE html&gt;<br/>&lt;html&gt;<br/>&lt;body&gt;<br/><br/>&lt;?php<br/>$txt1 = &quot;Learn PHP&quot;;<br/>$txt2 = &quot;Wikitechy.com&quot;;<br/>$x = 5;<br/>$y = 5;<br/><br/>print &quot;&lt;h2&gt;&quot; . $txt1 . &quot;&lt;/h2&gt;&quot;;<br/>print &quot;Study PHP at &quot; . $txt2 . &quot;&lt;br&gt;&quot;;<br/>print $x + $y;<br/>?&gt;<br/><br/>&lt;/body&gt;<br/>&lt;/html&gt;</code></pre> </div>
<h2 id="output-2">Output</h2>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4562" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/print-statement.png" alt="" width="1290" height="629" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/print-statement.png 1290w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/print-statement-300x146.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/print-statement-1024x499.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/print-statement-768x374.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/print-statement-390x190.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/print-statement-820x400.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/print-statement-1180x575.png 1180w" sizes="(max-width: 1290px) 100vw, 1290px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-is-echo-and-print-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is NULL in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-is-null-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-is-null-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Tue, 02 Aug 2022 12:16:39 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[check object is null in php]]></category>
		<category><![CDATA[how to assign null value in php]]></category>
		<category><![CDATA[how to use is null in mysql]]></category>
		<category><![CDATA[is not null in php]]></category>
		<category><![CDATA[is null function in mysql]]></category>
		<category><![CDATA[is null function in php]]></category>
		<category><![CDATA[is null in php mysql]]></category>
		<category><![CDATA[null in php]]></category>
		<category><![CDATA[what is null byte in php]]></category>
		<category><![CDATA[what is null coalescing in php]]></category>
		<category><![CDATA[what is null in php]]></category>
		<category><![CDATA[what is null in text]]></category>
		<category><![CDATA[what is null value in php]]></category>
		<category><![CDATA[what is the difference between null and empty in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4557</guid>

					<description><![CDATA[In PHP null () function is an inbuilt function which is used to find whether a variable is NULL or not. If it returns True the given variable is null, otherwise it returns False. If the value of $x is equal to NULL it returns true and it is an identical comparison operator. In PHP [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">In PHP null () function is an inbuilt function which is used to find whether a variable is NULL or not.</li>
<li style="text-align: justify;">If it returns True the given variable is null, otherwise it returns False.</li>
<li style="text-align: justify;">If the value of $x is equal to NULL it returns true and it is an identical comparison operator.</li>
<li style="text-align: justify;">In PHP null is a special data type which can have only one value that is NULL.</li>
<li style="text-align: justify;">NULL data type is a variable that has no value assigned to it and then any variable can be empty by setting the value NULL to the variable.</li>
</ul>
<h2 id="sample-code">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;!DOCTYPE html&gt;<br/>&lt;html&gt;<br/>&lt;body&gt;<br/><br/>&lt;?php<br/>$apple = 0;<br/>echo &quot;apple is &quot; . is_null($a) . &quot;&lt;br&gt;&quot;;<br/><br/>$orange = null;<br/>echo &quot;orange is &quot; . is_null($b) . &quot;&lt;br&gt;&quot;;<br/><br/>$grape = &quot;null&quot;;<br/>echo &quot;grape is &quot; . is_null($c) . &quot;&lt;br&gt;&quot;;<br/><br/>$watermelon = NULL;<br/>echo &quot;watermelon is &quot; . is_null($d) . &quot;&lt;br&gt;&quot;;<br/>?&gt;<br/><br/>&lt;/body&gt;<br/>&lt;/html&gt;</code></pre> </div>
<h2 id="output">Output</h2>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4558" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/null-value-in-php.png" alt="" width="1291" height="519" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/null-value-in-php.png 1291w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/null-value-in-php-300x121.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/null-value-in-php-1024x412.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/null-value-in-php-768x309.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/null-value-in-php-390x157.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/null-value-in-php-820x330.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/null-value-in-php-1180x474.png 1180w" sizes="(max-width: 1291px) 100vw, 1291px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-is-null-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What are the types of errors in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-are-the-types-of-errors-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-are-the-types-of-errors-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Tue, 02 Aug 2022 10:54:21 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[how many types of error in php]]></category>
		<category><![CDATA[how to fix php error]]></category>
		<category><![CDATA[php errors]]></category>
		<category><![CDATA[types of errors]]></category>
		<category><![CDATA[types of errors in php]]></category>
		<category><![CDATA[what are the different types of errors in php]]></category>
		<category><![CDATA[what are the types of errors in php]]></category>
		<category><![CDATA[what is error in php]]></category>
		<category><![CDATA[what is fatal error in php]]></category>
		<category><![CDATA[what is parse error in php]]></category>
		<category><![CDATA[what is warning error in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4549</guid>

					<description><![CDATA[In a programmer, error is a mistake that may be caused by writing incorrect code or incorrect syntax. An error message is displayed on your browser containing the filename along with a message describing the error, location and the line number in which error has occurred. In PHP there are various types of errors that [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">In a programmer, error is a mistake that may be caused by writing incorrect code or incorrect syntax.</li>
<li style="text-align: justify;">An error message is displayed on your browser containing the filename along with a message describing the error, location and the line number in which error has occurred.</li>
<li style="text-align: justify;">In PHP there are various types of errors that contains basically four main types of errors, they are
<ul>
<li>Syntax Error or Parse Error</li>
<li>Fatal Error</li>
<li>Warning Error</li>
<li>Notice Error</li>
</ul>
</li>
</ul>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4550" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-errors.png" alt="" width="1756" height="849" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-errors.png 1756w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-errors-300x145.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-errors-1024x495.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-errors-768x371.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-errors-1536x743.png 1536w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-errors-390x189.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-errors-820x396.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-errors-1180x571.png 1180w" sizes="(max-width: 1756px) 100vw, 1756px" /></p>
<h2 id="syntax-error-or-parse-error" style="text-align: justify;">Syntax Error or Parse Error</h2>
<ul style="text-align: justify;">
<li>A syntax error is a mistake in the syntax of source code, which can be done by programmers due to their lack of knowledge or concern.</li>
<li>At compile time compiler is used to catch the syntax error.</li>
<li>Due to common reasons these errors can occur like missing semicolon, unclosed quotes, or unclosed brackets, extra or missing parentheses and many more.</li>
<li>While compiling the program syntax error can be caught by the compiler and gives a syntax error or parse error message.</li>
</ul>
<h3 id="sample-code" style="text-align: justify;">Sample Code</h3>
<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/>    /*------------------syntax error-------------------*/  <br/>    echo &quot;Venkat: Hie! I&#039;m Venkat. &lt;/br&gt;&quot;;  <br/>    echo &quot;Lokesh: I&#039;m Lokesh. How are you?&quot;  <br/>    echo &quot;Venkat: I&#039;m good! and you?&quot;;  <br/>    echo &quot;Lokesh: I&#039;m also good&quot;;  <br/>?&gt;  </code></pre> </div>
<h3 id="output" style="text-align: justify;">Output</h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4551" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/syntax-error.png" alt="" width="1427" height="163" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/syntax-error.png 1427w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/syntax-error-300x34.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/syntax-error-1024x117.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/syntax-error-768x88.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/syntax-error-390x45.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/syntax-error-820x94.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/syntax-error-1180x135.png 1180w" sizes="(max-width: 1427px) 100vw, 1427px" /></p>
<h2 id="fatal-error" style="text-align: justify;">Fatal Error</h2>
<ul style="text-align: justify;">
<li>Fatal error is another type of error, which is occurred due to the use of undefined function.</li>
<li>The PHP compiler understands the PHP code and also recognizes the undefined function.</li>
<li>PHP compiler generates a fatal error, when a function is called without providing its definition.</li>
</ul>
<h3 id="sample-code-2" style="text-align: justify;">Sample Code</h3>
<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/>    /*------------------fatal error-------------------*/  <br/>    function add($f1, $f2) {  <br/>        $sum = $f1 + $f2;  <br/>        echo &quot;Addition:&quot; . $sum;  <br/>    }  <br/>      <br/>    $f1 = 23;  <br/>    $f2 = 56;  <br/>      <br/>    //call the function that is not defined  <br/>    //Generate fatal error  <br/>    catch_fatal_error();  <br/>    //echo &quot;Fatal Error&quot;;     <br/>?&gt;  </code></pre> </div>
<h3 id="output-2" style="text-align: justify;">Output</h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4552" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fatal-error.png" alt="" width="1425" height="158" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fatal-error.png 1425w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fatal-error-300x33.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fatal-error-1024x114.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fatal-error-768x85.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fatal-error-390x43.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fatal-error-820x91.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fatal-error-1180x131.png 1180w" sizes="(max-width: 1425px) 100vw, 1425px" /></p>
<h3 id="warning-error" style="text-align: justify;">Warning Error</h3>
<ul style="text-align: justify;">
<li>When the programmer tries to include a missing file there warning error is generated.</li>
<li>The PHP function calls that missing file which does not exist and warning error does not stop/prevent the execution of the program.</li>
</ul>
<h3 id="sample-code-3" style="text-align: justify;">Sample Code</h3>
<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/>    /*-------------------warning error------------------*/  <br/>    $cmpny = &#039;Wikitechy&#039;;  <br/>    echo &quot;Warning Error: &quot;;  <br/>      <br/>    //include a file in the code  <br/>    include (&#039;jtp.php&#039;);      <br/>?&gt;</code></pre> </div>
<h3 id="output-3" style="text-align: justify;">Output</h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4553" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/warning-error.png" alt="" width="1434" height="323" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/warning-error.png 1434w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/warning-error-300x68.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/warning-error-1024x231.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/warning-error-768x173.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/warning-error-390x88.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/warning-error-820x185.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/warning-error-1180x266.png 1180w" sizes="(max-width: 1434px) 100vw, 1434px" /></p>
<h2 id="notice-error" style="text-align: justify;">Notice Error</h2>
<ul style="text-align: justify;">
<li>Notice error is also same as warning error, when program contains something wrong, the notice error occurs.</li>
<li>Including a notice error, it allows/continue the execution of the program.</li>
<li>Notice error does not prevent the execution of the code and generally it occurs when we try to use or access a variable which is undefined.</li>
</ul>
<h3 id="sample-code-4" style="text-align: justify;">Sample Code</h3>
<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/>    /*------------------notice error-------------------*/  <br/>    $telecom = &quot;Airtel&quot;;  <br/>    echo $telecom;  <br/>    echo $automobile;  <br/>?&gt;  </code></pre> </div>
<h3 id="output-4" style="text-align: justify;">Output</h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4554" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/notice-error.png" alt="" width="1434" height="201" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/notice-error.png 1434w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/notice-error-300x42.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/notice-error-1024x144.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/notice-error-768x108.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/notice-error-390x55.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/notice-error-820x115.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/notice-error-1180x165.png 1180w" sizes="(max-width: 1434px) 100vw, 1434px" /></p>
<p style="text-align: justify;">
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-are-the-types-of-errors-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What are the types of arrays in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-are-the-types-of-arrays-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-are-the-types-of-arrays-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Tue, 02 Aug 2022 08:57:09 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[accessing array elements in php]]></category>
		<category><![CDATA[array in php example]]></category>
		<category><![CDATA[array push php]]></category>
		<category><![CDATA[associative array in php]]></category>
		<category><![CDATA[how many types array in php]]></category>
		<category><![CDATA[how many types of arrays are there]]></category>
		<category><![CDATA[indexed array in php]]></category>
		<category><![CDATA[multidimensional array in php]]></category>
		<category><![CDATA[php array functions]]></category>
		<category><![CDATA[php array length]]></category>
		<category><![CDATA[what are some examples of arrays]]></category>
		<category><![CDATA[what are the types of arrays]]></category>
		<category><![CDATA[what are the types of arrays in php]]></category>
		<category><![CDATA[what is array in php with example]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4543</guid>

					<description><![CDATA[In PHP an array is a type of data structure that allows us to store multiple elements of similar data type under a single variable thereby saving us the effort of creating a different variable for every data. Using their index or key arrays are helpful to create a list of elements of similar types, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4544" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-arrays.png" alt="" width="1359" height="849" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-arrays.png 1359w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-arrays-300x187.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-arrays-1024x640.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-arrays-768x480.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-arrays-390x244.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-arrays-820x512.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/types-of-arrays-1180x737.png 1180w" sizes="(max-width: 1359px) 100vw, 1359px" /></p>
<ul style="text-align: justify;">
<li>In PHP an array is a type of data structure that allows us to store multiple elements of similar data type under a single variable thereby saving us the effort of creating a different variable for every data.</li>
<li>Using their index or key arrays are helpful to create a list of elements of similar types, which can be accessed.</li>
<li>Suppose accordingly we want to store five names and print them and it can be easily done by the use of five different string variables.</li>
<li>Instead of five string variables, the number rises to a hundred, then it would be really difficult for the developer or user to create so many different variables.</li>
<li>Also using an index or a key array comes into play and helps us to store every element within a single variable and also allows easy access.</li>
<li>In PHP an array is created using array() function and basically there three types, they are</li>
</ul>
<ol style="text-align: justify;">
<li style="list-style-type: none;">
<ol>
<li>Indexed array</li>
<li>Associative array</li>
<li>Multidimensional array</li>
</ol>
</li>
</ol>
<h2 id="indexed-array" style="text-align: justify;">Indexed array</h2>
<ul style="text-align: justify;">
<li>Indexed array is represented by number which starts from 0 and we can store integer, object and string in the PHP array.</li>
<li>By default, all PHP array elements are assigned to an index number.</li>
</ul>
<h3 id="sample-code" style="text-align: justify;">Sample Code</h3>
<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/>$season=array(&quot;January&quot;,&quot;February&quot;,&quot;March&quot;,&quot;April&quot;);  <br/>echo &quot;Month are: $month[0], $month[1], $month[2] and $month[3]&quot;;  <br/>?&gt;  </code></pre> </div>
<h3 id="output" style="text-align: justify;">Output</h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4545" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/indexed-array.png" alt="" width="1115" height="158" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/indexed-array.png 1115w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/indexed-array-300x43.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/indexed-array-1024x145.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/indexed-array-768x109.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/indexed-array-390x55.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/indexed-array-820x116.png 820w" sizes="(max-width: 1115px) 100vw, 1115px" /></p>
<h2 id="associative-array" style="text-align: justify;">Associative Array</h2>
<ul style="text-align: justify;">
<li>Associative arrays are similar to the indexed arrays but instead of linear storage, every value can be assigned with a user-defined key of string type.</li>
<li>In PHP we can associate name with each array elements by using =&gt; symbol.</li>
</ul>
<h3 id="sample-code-2" style="text-align: justify;">Sample Code</h3>
<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/>$salary[&quot;Venkat&quot;]=&quot;350000&quot;;    <br/>$salary[&quot;Kishore&quot;]=&quot;450000&quot;;    <br/>$salary[&quot;Nizar&quot;]=&quot;200000&quot;;    <br/>echo &quot;Venkat salary: &quot;.$salary[&quot;Venkat&quot;].&quot;&lt;br/&gt;&quot;;  <br/>echo &quot;Kishore salary: &quot;.$salary[&quot;Kishore&quot;].&quot;&lt;br/&gt;&quot;;  <br/>echo &quot;Nizar salary: &quot;.$salary[&quot;Nizar&quot;].&quot;&lt;br/&gt;&quot;;  <br/>?&gt;    </code></pre> </div>
<h3 id="output-2" style="text-align: justify;">Output</h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4546" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/associative-array.png" alt="" width="1150" height="292" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/associative-array.png 1150w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/associative-array-300x76.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/associative-array-1024x260.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/associative-array-768x195.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/associative-array-390x99.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/associative-array-820x208.png 820w" sizes="(max-width: 1150px) 100vw, 1150px" /></p>
<h2 id="multidimensional-array" style="text-align: justify;">Multidimensional Array</h2>
<ul style="text-align: justify;">
<li>PHP multidimensional array is otherwise known as array of arrays and allows you to store tabular data in an array.</li>
<li>In the form of matrix PHP multidimensional array can be represented which is represented by row * column.</li>
</ul>
<h3 id="sample-code-3" style="text-align: justify;">Sample Code</h3>
<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">$emp = array  <br/>  (  <br/>  array(1,&quot;Venkat&quot;,400000),  <br/>  array(2,&quot;Kishore&quot;,500000),  <br/>  array(3,&quot;Nizar&quot;,300000)  <br/>  );  </code></pre> </div>
<h3 id="output-3" style="text-align: justify;">Output</h3>
<table width="0">
<tbody>
<tr>
<td width="215">&nbsp;</p>
<p>ID</td>
<td width="215">&nbsp;</p>
<p>Name</td>
<td width="215">&nbsp;</p>
<p>Salary</td>
</tr>
<tr>
<td width="215">&nbsp;</p>
<p>1</td>
<td width="215">&nbsp;</p>
<p>Venkat</td>
<td width="215">&nbsp;</p>
<p>400000</td>
</tr>
<tr>
<td width="215">&nbsp;</p>
<p>2</td>
<td width="215">&nbsp;</p>
<p>Kishore</td>
<td width="215">&nbsp;</p>
<p>500000</td>
</tr>
<tr>
<td width="215">&nbsp;</p>
<p>3</td>
<td width="215">&nbsp;</p>
<p>Nizar</td>
<td width="215">&nbsp;</p>
<p>300000</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;">
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-are-the-types-of-arrays-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What are the methods to submit form in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-are-the-methods-to-submit-form-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-are-the-methods-to-submit-form-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Tue, 02 Aug 2022 07:24:43 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[form submit in php mysql]]></category>
		<category><![CDATA[get and post method in php]]></category>
		<category><![CDATA[how to access submitted form data in php]]></category>
		<category><![CDATA[how to check form sumbission in php]]></category>
		<category><![CDATA[how to submit a form using php]]></category>
		<category><![CDATA[how to submit php form]]></category>
		<category><![CDATA[method get form]]></category>
		<category><![CDATA[php form handling]]></category>
		<category><![CDATA[php form processing with an example]]></category>
		<category><![CDATA[php form submit get method]]></category>
		<category><![CDATA[php form submit to database]]></category>
		<category><![CDATA[what are the methods to submit form in php]]></category>
		<category><![CDATA[working with forms in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4539</guid>

					<description><![CDATA[In PHP we can create and use forms in which we need to use PHP superglobals $_GET and $_POST to get form data. If the form request get or post we need to use $_GET, for post request $_POST to retrieve data from get request. In this get request is the default form request in [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">In PHP we can create and use forms in which we need to use PHP superglobals <a href="https://www.wikitechy.com/php/php-get">$_GET</a> and <a href="https://www.wikitechy.com/php/php-post">$_POST</a> to get form data.</li>
<li style="text-align: justify;">If the form request get or post we need to use $_GET, for post request $_POST to retrieve data from get request.</li>
<li style="text-align: justify;">In this get request is the default form request in which the data is passed through get request is visible on the URL browser so it is not secured and we can send limited amount of data through get request.</li>
<li style="text-align: justify;">Post request is widely used to submit form that have large amount of data such as image upload, file upload, registration form, login form, etc.</li>
<li style="text-align: justify;">In this the data passed through post request is not visible on the URL browser so it is secured and we can send large amount of data through post request.</li>
</ul>
<h2 id="sample-code">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;html&gt;<br/>&lt;body&gt;<br/><br/>&lt;form action=&quot;welcome_get.php&quot; method=&quot;get&quot;&gt;<br/>Name: &lt;input type=&quot;text&quot; name=&quot;name&quot;&gt;&lt;br&gt;<br/>E-mail: &lt;input type=&quot;text&quot; name=&quot;email&quot;&gt;&lt;br&gt;<br/>&lt;input type=&quot;submit&quot;&gt;<br/>&lt;/form&gt;<br/><br/>&lt;/body&gt;<br/>&lt;/html&gt;</code></pre> </div>
<h2 id="output">Output</h2>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4540" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-function.png" alt="" width="1289" height="482" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-function.png 1289w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-function-300x112.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-function-1024x383.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-function-768x287.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-function-390x146.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-function-820x307.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/get-function-1180x441.png 1180w" sizes="(max-width: 1289px) 100vw, 1289px" /></p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4541" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/methods-to-submit-form-in-php.png" alt="" width="1288" height="555" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/methods-to-submit-form-in-php.png 1288w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/methods-to-submit-form-in-php-300x129.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/methods-to-submit-form-in-php-1024x441.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/methods-to-submit-form-in-php-768x331.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/methods-to-submit-form-in-php-390x168.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/methods-to-submit-form-in-php-820x353.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/methods-to-submit-form-in-php-1180x508.png 1180w" sizes="(max-width: 1288px) 100vw, 1288px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-are-the-methods-to-submit-form-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What are Magic Constants in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-are-magic-constants-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-are-magic-constants-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Mon, 01 Aug 2022 09:09:07 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[default constant in php]]></category>
		<category><![CDATA[define and constant in php]]></category>
		<category><![CDATA[magic constant]]></category>
		<category><![CDATA[magic constant c++]]></category>
		<category><![CDATA[magic constants in php]]></category>
		<category><![CDATA[php __class__]]></category>
		<category><![CDATA[php __file__]]></category>
		<category><![CDATA[undefined constant php]]></category>
		<category><![CDATA[what is a constant in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4535</guid>

					<description><![CDATA[In PHP magic constants are the predefined constants which is used on the basis of their use. Constants are created by various extensions and there are nine magic constants in the PHP and all of the constant resolved at the compile-time, not like the regular constant which is resolved at run time. In this there [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">In PHP magic constants are the predefined constants which is used on the basis of their use.</li>
<li style="text-align: justify;">Constants are created by various extensions and there are nine magic constants in the PHP and all of the constant resolved at the compile-time, not like the regular constant which is resolved at run time.</li>
<li style="text-align: justify;">In this there are eight magic constants which start and end with double underscores (__), they are.
<ul>
<li>__line__</li>
<li>__file__</li>
<li>__dir__</li>
<li>__function__</li>
<li>__class__</li>
<li>__method__</li>
<li>__namespace__</li>
<li>__trait__</li>
</ul>
</li>
</ul>
<h2 id="__line__" style="text-align: justify;">__line__</h2>
<ul style="text-align: justify;">
<li>This type of magic constant returns the current line number of the file.</li>
<li>In our program file if we use this magic constant somewhere then this constant will display the line number during compile time.</li>
</ul>
<h3 id="syntax" style="text-align: justify;"><strong>Syntax</strong></h3>
<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">         __line__</code></pre> </div>
<h2 id="__file__" style="text-align: justify;">__file__</h2>
<ul style="text-align: justify;">
<li>This type of magic constant return the full path of the executed file with the name of the file.</li>
</ul>
<h3 id="syntax-2" style="text-align: justify;"><strong>Syntax</strong></h3>
<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">         __file__</code></pre> </div>
<h2 id="__dir__" style="text-align: justify;">__dir__</h2>
<ul style="text-align: justify;">
<li>This type of magic constant returns the directory of the executed file.</li>
</ul>
<h3 id="syntax-3" style="text-align: justify;"><strong>Syntax</strong></h3>
<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">          __dir__</code></pre> </div>
<h2 id="__function__"><span lang="EN-US" style="font-size: 16pt; font-family: 'Segoe UI', sans-serif; color: #000000; letter-spacing: 0.1pt;">__function__</span></h2>
<ul style="text-align: justify;">
<li>This type of magic constant returns the name of the function where it is included.</li>
</ul>
<h3 id="syntax-4" style="text-align: justify;"><strong>Syntax</strong></h3>
<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">         __function__</code></pre> </div>
<h2 id="__class__"><span lang="EN-US" style="font-size: 16pt; font-family: 'Segoe UI', sans-serif; color: #000000; letter-spacing: 0.1pt;">__class__</span></h2>
<ul style="text-align: justify;">
<li>This type of magic constant returns the name of the class where it is included.</li>
</ul>
<h3 id="syntax-5" style="text-align: justify;"><strong>Syntax</strong></h3>
<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">__class__</code></pre> </div>
<h2 id="__method__" style="text-align: justify;">__method__</h2>
<ul style="text-align: justify;">
<li>This type of magic constant returns the method name where it is included.</li>
</ul>
<h3 id="syntax-6" style="text-align: justify;"><strong>Syntax</strong></h3>
<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">       __method__</code></pre> </div>
<h2 id="__namespace__" style="text-align: justify;">__namespace__</h2>
<p style="text-align: justify;">This type of magic constant returns the current namespace where it is included.</p>
<h3 id="syntax-7" style="text-align: justify;"><strong>Syntax</strong></h3>
<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">       __namespace__</code></pre> </div>
<h2 id="__trait__" style="text-align: justify;">__trait__</h2>
<ul style="text-align: justify;">
<li>This type of magic constant returns the trait name where it is included.</li>
</ul>
<h3 id="syntax-8" style="text-align: justify;"><strong>Syntax</strong></h3>
<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">  __trait__</code></pre> </div>
<p style="text-align: justify;">
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-are-magic-constants-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What are the different loops in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-are-the-different-loops-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-are-the-different-loops-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Mon, 01 Aug 2022 08:43:27 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[do loop in php]]></category>
		<category><![CDATA[foreach loop in php]]></category>
		<category><![CDATA[how many loops in php]]></category>
		<category><![CDATA[how many types of loops are supported in php]]></category>
		<category><![CDATA[how many types of loops are there in php]]></category>
		<category><![CDATA[loop in php]]></category>
		<category><![CDATA[php loop array]]></category>
		<category><![CDATA[php while loop multiple conditions]]></category>
		<category><![CDATA[print 1 to 10 using for loop in php]]></category>
		<category><![CDATA[what are the different loops in php]]></category>
		<category><![CDATA[what is loops in php]]></category>
		<category><![CDATA[while loop in php]]></category>
		<category><![CDATA[while loop in php mysql]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4528</guid>

					<description><![CDATA[Like any other language, in PHP loop is used to execute a statement or a block of statements, multiple times until and unless a specific condition is met. Loops helps the user to save both effort and time of writing the same code multiple times. PHP supports four types of looping techniques, they are: For [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li>Like any other language, in PHP loop is used to execute a statement or a block of statements, multiple times until and unless a specific condition is met.</li>
<li>Loops helps the user to save both effort and time of writing the same code multiple times.</li>
<li>PHP supports four types of looping techniques, they are:</li>
</ul>
<ol>
<li style="list-style-type: none;">
<ol>
<li>For loop</li>
<li>While loop</li>
<li>Do-while loop</li>
<li>Foreach loop</li>
</ol>
</li>
</ol>
<h2 id="for-loop">For loop</h2>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4531 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/for-loop.png" alt="" width="725" height="625" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/for-loop.png 725w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/for-loop-300x259.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/for-loop-390x336.png 390w" sizes="(max-width: 725px) 100vw, 725px" /></p>
<ul>
<li>For loop is used when the user knows in advance, how many times the block needs to execute.</li>
<li>The number of iterations is known beforehand and these types of loops are also known as entry-controlled loops.</li>
<li>Initialization expression, test expression, update expression are the three main parameters to the code.</li>
</ul>
<h3 id="syntax">Syntax</h3>
<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">for (initialization expression; test condition; update expression) {<br/>          // code to be executed<br/>        }</code></pre> </div>
<h2 id="while-loop">While loop</h2>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4532" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/while-loop.png" alt="" width="728" height="633" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/while-loop.png 728w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/while-loop-300x261.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/while-loop-390x339.png 390w" sizes="(max-width: 728px) 100vw, 728px" /></p>
<ul>
<li>While loop is also an entry control loop like for loop condition.</li>
<li>First it checks the condition at the start of the loop and if its true then it enters the loop and executes the block of statements, and goes on executing it as long as the condition holds true.</li>
</ul>
<h3 id="syntax-2"><strong>Syntax</strong></h3>
<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">             while (if the condition is true) {<br/>              // code is executed<br/>         }</code></pre> </div>
<h2 id="do-while-loop">Do-while loop</h2>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4533" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/do-while.png" alt="" width="719" height="633" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/do-while.png 719w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/do-while-300x264.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/do-while-390x343.png 390w" sizes="(max-width: 719px) 100vw, 719px" /></p>
<ul>
<li>Do while loop is an exit control loop which means that it first enters the loop, executes the statements, and then checks the condition.</li>
<li>Using do-while a statement is executed at least once.</li>
<li>The program is executed as long as the condition holds true, after executing once.</li>
</ul>
<h3 id="syntax-3"><strong>Syntax</strong></h3>
<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">do {<br/><br/>               //code is executed<br/><br/>         } while (if condition is true);</code></pre> </div>
<h2 id="foreach-loop">Foreach loop</h2>
<ul>
<li>Foreach loop is used to iterate over arrays and for every counter of loop, an array element is assigned and the next counter is shifted to the next element.</li>
</ul>
<h3 id="syntax-4"><strong>Syntax</strong></h3>
<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">foreach (array_element as value) {<br/>         //code to be executed<br/>       }</code></pre> </div>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-are-the-different-loops-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What are cookies ? How to create cookies in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/what-are-cookies-how-to-create-cookies-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/what-are-cookies-how-to-create-cookies-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Mon, 01 Aug 2022 06:11:36 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[access and delete cookies in php]]></category>
		<category><![CDATA[get cookie in php]]></category>
		<category><![CDATA[how to create]]></category>
		<category><![CDATA[how to create cookies in php]]></category>
		<category><![CDATA[how to delete cookies in php]]></category>
		<category><![CDATA[how to modify cookies in php]]></category>
		<category><![CDATA[how to use cookies in php]]></category>
		<category><![CDATA[php cookies]]></category>
		<category><![CDATA[php cookies with example]]></category>
		<category><![CDATA[sessin and cookies in php with example]]></category>
		<category><![CDATA[types of cookies in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4523</guid>

					<description><![CDATA[In PHP cookie is a small file with a maximum size of 4KB that the web server stores on the client computer. Cookies are typically used to keep track of information such as a username that the site can retrieve to personalize the page when the user visits the website next time. They can only [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">In PHP cookie is a small file with a maximum size of 4KB that the web server stores on the client computer.</li>
<li style="text-align: justify;">Cookies are typically used to keep track of information such as a username that the site can retrieve to personalize the page when the user visits the website next time.</li>
<li style="text-align: justify;">They can only be read from the domain that it has been issued from.</li>
<li style="text-align: justify;">In browser cookies are usually set in an HTTP header but JavaScript can also set a cookie directly.</li>
<li style="text-align: justify;">In PHP setcookie () function is used to set a cookie.</li>
<li style="text-align: justify;">This function needs to be called prior to any output generated by the script otherwise the cookie will not be set.</li>
<li style="text-align: justify;">In setcookie () function name parameter is used to set the name of the cookie and value parameter is used to set the value of the cookie.</li>
<li style="text-align: justify;">In setcookie () function expire parameter is used to set the expiry timestamp of the cookie after which the cookie can’t be accessed.</li>
<li style="text-align: justify;">In setcookie () function path parameter is used to specify the path on the server for which the cookie will be available.</li>
<li style="text-align: justify;">In setcookie () function domain parameter is used to specify the domain for which the cookie is available.</li>
<li style="text-align: justify;">In setcookie () function security parameter is used to indicate that the cookie should be sent only if a secure HTTPS connection exists.</li>
</ul>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4524 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/what-is-cookies.png" alt="" width="1550" height="583" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/what-is-cookies.png 1550w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/what-is-cookies-300x113.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/what-is-cookies-1024x385.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/what-is-cookies-768x289.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/what-is-cookies-1536x578.png 1536w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/what-is-cookies-390x147.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/what-is-cookies-820x308.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/what-is-cookies-1180x444.png 1180w" sizes="(max-width: 1550px) 100vw, 1550px" /></p>
<h2 id="syntax">Syntax</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">setcookie (name, value, expire, path, domain, security);</code></pre> </div>
<h2 id="sample-code">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;!DOCTYPE html&gt;<br/>&lt;?php<br/>setcookie(&quot;test_cookie&quot;, &quot;test&quot;, time() + 3600, &#039;/&#039;);<br/>?&gt;<br/>&lt;html&gt;<br/>&lt;body&gt;<br/><br/>&lt;?php<br/>if(count($_COOKIE) &gt; 0) {<br/>    echo &quot;Cookies are enabled.&quot;;<br/>} else {<br/>    echo &quot;Cookies are disabled.&quot;;<br/>}<br/>?&gt;<br/><br/>&lt;/body&gt;<br/>&lt;/html&gt;</code></pre> </div>
<h2 id="output">Output</h2>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4525" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/cookies.png" alt="" width="1286" height="533" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/cookies.png 1286w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/cookies-300x124.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/cookies-1024x424.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/cookies-768x318.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/cookies-390x162.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/cookies-820x340.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/cookies-1180x489.png 1180w" sizes="(max-width: 1286px) 100vw, 1286px" /></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/what-are-cookies-how-to-create-cookies-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>List out the features of PHP</title>
		<link>https://www.wikitechy.com/interview-questions/php/list-out-the-features-of-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/list-out-the-features-of-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Mon, 01 Aug 2022 06:00:05 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[best features of php]]></category>
		<category><![CDATA[characteristics of php]]></category>
		<category><![CDATA[characteristics of php variables]]></category>
		<category><![CDATA[explain any two features of php]]></category>
		<category><![CDATA[features of php]]></category>
		<category><![CDATA[features of php 7]]></category>
		<category><![CDATA[full form of php]]></category>
		<category><![CDATA[how many types of php]]></category>
		<category><![CDATA[list features of php]]></category>
		<category><![CDATA[main features of php]]></category>
		<category><![CDATA[php features]]></category>
		<category><![CDATA[php features and advantages]]></category>
		<category><![CDATA[top features of php]]></category>
		<category><![CDATA[uses of php]]></category>
		<category><![CDATA[what are some of the advanced features of php]]></category>
		<category><![CDATA[what are the characteristics of php variables]]></category>
		<category><![CDATA[what are the functions of php]]></category>
		<category><![CDATA[what are the general language features of php]]></category>
		<category><![CDATA[what are the unique features of php]]></category>
		<category><![CDATA[what is php and features of php]]></category>
		<category><![CDATA[what is the main purpose of php]]></category>
		<category><![CDATA[what is the role of php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4520</guid>

					<description><![CDATA[Performance Compare to other languages such as JSP and ASP, PHP script is executed much faster than those scripts which are written. The server workload and loading time is automatically reduced, which results in faster processing better and speed performance, while PHP uses its own memory. Open Source In the web PHP source code and [&#8230;]]]></description>
										<content:encoded><![CDATA[<h3 id=""><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4521 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/features-of-php.png" alt="" width="1832" height="1042" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/features-of-php.png 1832w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/features-of-php-300x171.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/features-of-php-1024x582.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/features-of-php-768x437.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/features-of-php-1536x874.png 1536w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/features-of-php-390x222.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/features-of-php-820x466.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/features-of-php-1180x671.png 1180w" sizes="(max-width: 1832px) 100vw, 1832px" /></h3>
<h3 id="performance" style="text-align: justify;"><strong>Performance</strong></h3>
<ul style="text-align: justify;">
<li>Compare to other languages such as JSP and ASP, PHP script is executed much faster than those scripts which are written.</li>
<li>The server workload and loading time is automatically reduced, which results in faster processing better and speed performance, while PHP uses its own memory.</li>
</ul>
<h3 id="open-source" style="text-align: justify;"><strong>Open Source</strong></h3>
<ul style="text-align: justify;">
<li>In the web PHP source code and software are freely available.</li>
<li>Without paying any cost, we can develop all the versions of PHP according to our requirement.</li>
</ul>
<h3 id="familiarity-with-syntax" style="text-align: justify;"><strong>Familiarity with syntax</strong></h3>
<ul style="text-align: justify;">
<li>PHP programmers are comfortable coding with it and it has easily understandable syntax.</li>
</ul>
<h3 id="embedded" style="text-align: justify;"><strong>Embedded</strong></h3>
<ul style="text-align: justify;">
<li>Within HTML tags and script tags, PHP code can be easily embedded.</li>
</ul>
<h3 id="platform-independent" style="text-align: justify;"><strong>Platform Independent</strong></h3>
<ul style="text-align: justify;">
<li>PHP application developed in one OS it can be easily executed in other OS also and it is available for Mac, Windows, Linux and Unix.</li>
</ul>
<h3 id="database-support" style="text-align: justify;"><strong>Database Support</strong></h3>
<ul style="text-align: justify;">
<li>PHP supports all the leading databases such as MySQL, Oracle Database Corporation, SQLite, etc.</li>
</ul>
<h3 id="error-reporting" style="text-align: justify;"><strong>Error Reporting</strong></h3>
<ul style="text-align: justify;">
<li>At runtime PHP has predefined error reporting constants to generate an error notice or warning.</li>
</ul>
<h3 id="loosely-typed-language" style="text-align: justify;"><strong>Loosely Typed Language</strong></h3>
<ul style="text-align: justify;">
<li>PHP allows us to use a variable without declaring its datatype and automatically it will be taken at the time of execution based on the type of data it contains on its value.</li>
</ul>
<h3 id="web-servers-support" style="text-align: justify;"><strong>Web servers Support</strong></h3>
<ul style="text-align: justify;">
<li>Local servers like Apache, Netscape, Microsoft IIS, etc. are compatible with PHP.</li>
</ul>
<h3 id="security" style="text-align: justify;"><strong>Security</strong></h3>
<ul style="text-align: justify;">
<li>To develop the website PHP is a secure language and it consists ofmultiple layers of security to prevent threads and malicious attacks.</li>
</ul>
<h3 id="control" style="text-align: justify;"><strong>Control</strong></h3>
<ul style="text-align: justify;">
<li>In a few lines of code different programming languages require long script or code, whereas PHP can do the same work.</li>
</ul>
<h3 id="a-helpful-php-community" style="text-align: justify;"><strong>A Helpful PHP Community</strong></h3>
<ul style="text-align: justify;">
<li>Learning PHP from the communities is one of the significant benefits and it has a large community of developers who regularly updates tutorials, online help, FAQs and documentation.</li>
</ul>
<p style="text-align: justify;">
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/list-out-the-features-of-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to read a file in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/how-to-read-a-file-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/how-to-read-a-file-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Mon, 01 Aug 2022 05:45:29 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[file reading and writing in php]]></category>
		<category><![CDATA[fopen php]]></category>
		<category><![CDATA[how to read a file in php]]></category>
		<category><![CDATA[how to read a file in php file]]></category>
		<category><![CDATA[php file example]]></category>
		<category><![CDATA[php file open/read/close]]></category>
		<category><![CDATA[php file reader]]></category>
		<category><![CDATA[php files & i/o]]></category>
		<category><![CDATA[php read file]]></category>
		<category><![CDATA[php read text file line by line]]></category>
		<category><![CDATA[php readfile() function]]></category>
		<category><![CDATA[read a file in php]]></category>
		<category><![CDATA[read a plain text file with php]]></category>
		<category><![CDATA[read text files in php]]></category>
		<category><![CDATA[writing files in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4515</guid>

					<description><![CDATA[PHP File provides various functions to read data. There are different functions that allow you to read all file data, read data character by character and read data line by line. The PHP file available read functions are given below, they are: fread () fgets () fgetc () PHP Read File- fread () PHP fread [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;"><a href="https://www.wikitechy.com/php/">PHP</a> File provides various functions to read data.</li>
<li style="text-align: justify;">There are different functions that allow you to read all file data, read data character by character and read data line by line.</li>
<li style="text-align: justify;">The PHP file available read functions are given below, they are:</li>
</ul>
<ol style="text-align: justify;">
<li style="list-style-type: none;">
<ol>
<li>fread ()</li>
<li>fgets ()</li>
<li>fgetc ()</li>
</ol>
</li>
</ol>
<h2 id="php-read-file-fread" style="text-align: justify;"><strong>PHP Read File- fread ()</strong></h2>
<ul style="text-align: justify;">
<li>PHP fread () function is used to read data of the file and it consists of two arguments, they are file size and file resource.</li>
</ul>
<h3 id="sample-code" style="text-align: justify;"><strong>Sample Code</strong></h3>
<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/>$filename = &quot;c:\\file1.txt&quot;;    <br/>$fp = fopen($filename, &quot;r&quot;);//open file in read mode    <br/>  <br/>$contents = fread($fp, filesize($filename));//read file    <br/>  <br/>echo &quot;&lt;pre&gt;$contents&lt;/pre&gt;&quot;;//printing data of file  <br/>fclose($fp);//close file    <br/>?&gt;   </code></pre> </div>
<h3 id="output" style="text-align: justify;"><strong>Output</strong></h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4516" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fread-function.png" alt="" width="1425" height="261" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fread-function.png 1425w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fread-function-300x55.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fread-function-1024x188.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fread-function-768x141.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fread-function-390x71.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fread-function-820x150.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fread-function-1180x216.png 1180w" sizes="(max-width: 1425px) 100vw, 1425px" /></p>
<h2 id="php-read-file-fgets" style="text-align: justify;">PHP Read file- fgets ()</h2>
<ul style="text-align: justify;">
<li>To read single line from the file PHP fgets () function is used.</li>
</ul>
<h3 id="sample-code-2" style="text-align: justify;"><strong>Sample Code</strong></h3>
<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/>$fp = fopen(&quot;c:\\file1.txt&quot;, &quot;r&quot;);//open file in read mode    <br/>echo fgets($fp);  <br/>fclose($fp);  <br/>?&gt;   </code></pre> </div>
<h3 id="output-2" style="text-align: justify;"><strong>Output</strong></h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4517" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgets-function.png" alt="" width="1430" height="151" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgets-function.png 1430w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgets-function-300x32.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgets-function-1024x108.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgets-function-768x81.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgets-function-390x41.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgets-function-820x87.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgets-function-1180x125.png 1180w" sizes="(max-width: 1430px) 100vw, 1430px" /></p>
<h2 id="php-read-file-fgetc" style="text-align: justify;">PHP Read file- fgetc ()</h2>
<ul style="text-align: justify;">
<li>To read single character from the file PHP fgetc () function is used and use! feof () function inside the while loop to get all data using fgetc () function.</li>
</ul>
<h3 id="sample-code-3" style="text-align: justify;"><strong>Sample Code</strong></h3>
<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/>$fp = fopen(&quot;c:\\file1.txt&quot;, &quot;r&quot;);//open file in read mode    <br/>while(!feof($fp)) {  <br/>  echo fgetc($fp);  <br/>}  <br/>fclose($fp);  <br/>?&gt;    </code></pre> </div>
<h3 id="output-3" style="text-align: justify;"><strong>Output</strong></h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4518" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgetc-function.png" alt="" width="1424" height="150" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgetc-function.png 1424w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgetc-function-300x32.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgetc-function-1024x108.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgetc-function-768x81.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgetc-function-390x41.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgetc-function-820x86.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/fgetc-function-1180x124.png 1180w" sizes="(max-width: 1424px) 100vw, 1424px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/how-to-read-a-file-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How many data types are there in PHP ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/how-many-data-types-are-there-in-php/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/how-many-data-types-are-there-in-php/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Sat, 30 Jul 2022 10:49:13 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[datatypes in php]]></category>
		<category><![CDATA[null data type in php]]></category>
		<category><![CDATA[php 5 data types]]></category>
		<category><![CDATA[php data types]]></category>
		<category><![CDATA[php variable type declaration]]></category>
		<category><![CDATA[special data types in php]]></category>
		<category><![CDATA[types of variables in php with example]]></category>
		<category><![CDATA[understanding the php data types]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4506</guid>

					<description><![CDATA[PHP data types are used to hold different types of values or data. There are eight primitive data types which are further categorized into three types, they are: Scalar types Compound types Special types Scalar data types Scalar data types hold only single value and it consists of four data types, they are boolean, integer, [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">PHP data types are used to hold different types of values or data.</li>
<li style="text-align: justify;">There are eight primitive data types which are further categorized into three types, they are:
<ul>
<li>Scalar types</li>
<li>Compound types</li>
<li>Special types</li>
</ul>
</li>
</ul>
<h2 id="scalar-data-types" style="text-align: justify;"><strong>Scalar data types</strong></h2>
<ul style="text-align: justify;">
<li>Scalar data types hold only single value and it consists of four data types, they are boolean, integer, float and string.</li>
</ul>
<h3 id="boolean" style="text-align: justify;"><strong>Boolean</strong></h3>
<ul style="text-align: justify;">
<li>Booleans are the simplest data type works like switch and holds only two values TRUE (1) or FALSE (0).</li>
<li>It is often used with conditional statements were if the condition is correct, it returns TRUE otherwise FALSE.</li>
</ul>
<p style="text-align: justify;"><strong>Sample Code</strong></p>
<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/>    if (TRUE)  <br/>        echo &quot;This condition is TRUE.&quot;;  <br/>    if (FALSE)  <br/>        echo &quot;This condition is FALSE.&quot;;  <br/>?&gt;  </code></pre> </div>
<p style="text-align: justify;"><strong>Output</strong></p>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4507" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/boolean.png" alt="" width="2008" height="227" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/boolean.png 2008w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/boolean-300x34.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/boolean-1024x116.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/boolean-768x87.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/boolean-1536x174.png 1536w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/boolean-390x44.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/boolean-820x93.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/boolean-1180x133.png 1180w" sizes="(max-width: 2008px) 100vw, 2008px" /></p>
<h3 id="integer" style="text-align: justify;">Integer</h3>
<ul style="text-align: justify;">
<li>Integer means numeric data, it can be either positive or negative sign.</li>
<li>It holds only whole numbers, like numbers without decimal points or fractional parts.</li>
</ul>
<p style="text-align: justify;"><strong>Sample Code</strong></p>
<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/>    $dec1 = 34;  <br/>    $oct1 = 0243;  <br/>    $hexa1 = 0x45;  <br/>    echo &quot;Decimal number: &quot; .$dec1. &quot;&lt;/br&gt;&quot;;  <br/>    echo &quot;Octal number: &quot; .$oct1. &quot;&lt;/br&gt;&quot;;  <br/>    echo &quot;HexaDecimal number: &quot; .$hexa1. &quot;&lt;/br&gt;&quot;;  <br/>?&gt;  </code></pre> </div>
<p style="text-align: justify;"><strong>Output</strong></p>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4508" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/integer.png" alt="" width="2346" height="442" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/integer.png 2346w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/integer-300x57.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/integer-1024x193.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/integer-768x145.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/integer-1536x289.png 1536w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/integer-2048x386.png 2048w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/integer-390x73.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/integer-820x154.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/integer-1180x222.png 1180w" sizes="(max-width: 2346px) 100vw, 2346px" /></p>
<h3 id="float" style="text-align: justify;">Float</h3>
<ul style="text-align: justify;">
<li>A floating-point number is a number with a decimal point and unlike integer, it can hold numbers with a fractional or decimal point, including a negative or positive sign.</li>
</ul>
<p style="text-align: justify;"><strong>Sample Code</strong></p>
<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/>    $n1 = 19.34;  <br/>    $n2 = 54.472;  <br/>    $sum = $n1 + $n2;  <br/>    echo &quot;Addition of floating numbers: &quot; .$sum;  <br/>?&gt;  </code></pre> </div>
<p style="text-align: justify;"><strong>Output</strong></p>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4509" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/float-datatype-in-php.png" alt="" width="2358" height="295" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/float-datatype-in-php.png 2358w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/float-datatype-in-php-300x38.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/float-datatype-in-php-1024x128.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/float-datatype-in-php-768x96.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/float-datatype-in-php-1536x192.png 1536w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/float-datatype-in-php-2048x256.png 2048w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/float-datatype-in-php-390x49.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/float-datatype-in-php-820x103.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/float-datatype-in-php-1180x148.png 1180w" sizes="(max-width: 2358px) 100vw, 2358px" /></p>
<h3 id="string" style="text-align: justify;">String</h3>
<ul style="text-align: justify;">
<li>String is a non-numeric data type which holds letters or any alphabets, numbers, and even special characters.</li>
<li>Its value must be enclosed either within <strong>single quotes </strong>or in <strong>double quotes</strong> and both are treated differently.</li>
</ul>
<p style="text-align: justify;"><strong>Sample  Code</strong></p>
<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/>    $company = &quot;Wikitechy&quot;;  <br/>    //both single and double quote statements will treat different  <br/>    echo &quot;Welcome to $company&quot;;  <br/>    echo &quot;&lt;/br&gt;&quot;;  <br/>    echo &quot;Welcome to $company&#039;;  <br/>?&gt;  </code></pre> </div>
<p style="text-align: justify;"><strong>Output</strong></p>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4510" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/string-datatype-php.png" alt="" width="1614" height="379" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/string-datatype-php.png 1614w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/string-datatype-php-300x70.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/string-datatype-php-1024x240.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/string-datatype-php-768x180.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/string-datatype-php-1536x361.png 1536w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/string-datatype-php-390x92.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/string-datatype-php-820x193.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/string-datatype-php-1180x277.png 1180w" sizes="(max-width: 1614px) 100vw, 1614px" /></p>
<h2 id="compound-data-type" style="text-align: justify;"><strong>Compound data type</strong></h2>
<ul style="text-align: justify;">
<li>Compound data type can hold multiple and it consists of two data types, they are array and object.</li>
</ul>
<h3 id="array" style="text-align: justify;"><strong>Array</strong></h3>
<ul style="text-align: justify;">
<li>In single variable an array canstore multiple values of same data type.</li>
</ul>
<p style="text-align: justify;"><strong>Sample Code</strong></p>
<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/>    $bikes = array (&quot;Royal Enfield&quot;, &quot;Yamaha&quot;, &quot;KTM&quot;);  <br/><br/>    var_dump($bikes);   //the var_dump() function returns the datatype and values <br/><br/>    echo &quot;&lt;/br&gt;&quot;;  <br/><br/>    echo &quot;Array Element1: $bikes[0] &lt;/br&gt;&quot;;  <br/><br/>    echo &quot;Array Element2: $bikes[1] &lt;/br&gt;&quot;;  <br/><br/>    echo &quot;Array Element3: $bikes[2] &lt;/br&gt;&quot;;  <br/><br/>?&gt;  </code></pre> </div>
<p style="text-align: justify;"><strong>Output</strong></p>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4511" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/array-datatype-in-php.png" alt="" width="2356" height="526" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/array-datatype-in-php.png 2356w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/array-datatype-in-php-300x67.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/array-datatype-in-php-1024x229.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/array-datatype-in-php-768x171.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/array-datatype-in-php-1536x343.png 1536w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/array-datatype-in-php-2048x457.png 2048w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/array-datatype-in-php-390x87.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/array-datatype-in-php-820x183.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/array-datatype-in-php-1180x263.png 1180w" sizes="(max-width: 2356px) 100vw, 2356px" /></p>
<h3 id="object" style="text-align: justify;"><strong>Object</strong></h3>
<ul style="text-align: justify;">
<li>Objects are the instances of user-defined classes that can store both functions and values.</li>
<li>It must be explicitly declared.</li>
</ul>
<p style="text-align: justify;"><strong>Sample Code</strong></p>
<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/>     class bike {  <br/>          function model() {  <br/>               $model_name = &quot;Jawa&quot;;  <br/>               echo &quot;Bike Model: &quot; .$model_name;  <br/>             }  <br/>     }  <br/>     $obj = new bike();  <br/>     $obj -&gt; model();  <br/>?&gt;  </code></pre> </div>
<p style="text-align: justify;"><strong>Output</strong></p>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4512" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/object-datatype-in-php.png" alt="" width="1188" height="220" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/object-datatype-in-php.png 1188w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/object-datatype-in-php-300x56.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/object-datatype-in-php-1024x190.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/object-datatype-in-php-768x142.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/object-datatype-in-php-390x72.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/object-datatype-in-php-820x152.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/object-datatype-in-php-1180x219.png 1180w" sizes="(max-width: 1188px) 100vw, 1188px" /></p>
<h2 id="special-data-type" style="text-align: justify;">Special Data Type</h2>
<ul style="text-align: justify;">
<li>Special data types consist of two types, they are Null and resource data type.</li>
</ul>
<h3 id="null" style="text-align: justify;">Null</h3>
<ul style="text-align: justify;">
<li>Null is a special data type that has only one value is NULL and there is a convention of writing it in capital letters as it is case sensitive.</li>
<li>In special data type NULL defined a variable with no value.</li>
</ul>
<p style="text-align: justify;"><strong>Sample Code</strong></p>
<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/>     $nl = NULL;  <br/>    echo $nl;   //it will not give any output  <br/>    ?&gt;  </code></pre> </div>
<p style="text-align: justify;"><strong>Output</strong></p>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4513" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/null-datatype.png" alt="" width="1418" height="59" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/null-datatype.png 1418w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/null-datatype-300x12.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/null-datatype-1024x43.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/null-datatype-768x32.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/null-datatype-390x16.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/null-datatype-820x34.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/null-datatype-1180x49.png 1180w" sizes="(max-width: 1418px) 100vw, 1418px" /></p>
<h3 id="resource" style="text-align: justify;">Resource:</h3>
<ul style="text-align: justify;">
<li>In PHP resources are not the exact data type and basically these are used to references to external PHP resources or store some small function calls.</li>
</ul>
<p style="text-align: justify;">
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/how-many-data-types-are-there-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to create a database using PHP and MySQL ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/how-to-create-a-database-using-php-and-mysql/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/how-to-create-a-database-using-php-and-mysql/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Thu, 28 Jul 2022 05:18:54 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[accessing the database in php]]></category>
		<category><![CDATA[create database mysql]]></category>
		<category><![CDATA[Create MySQL Database And Table Using PHP In XAMPP]]></category>
		<category><![CDATA[Create MySQL Database Using PHP]]></category>
		<category><![CDATA[Creating MySQL Database Using PHP]]></category>
		<category><![CDATA[database connection in php with mysql]]></category>
		<category><![CDATA[how can we connect to a mysql database from a php script]]></category>
		<category><![CDATA[How to Connect MySQL Database with PHP Website]]></category>
		<category><![CDATA[How to create a database in MySQL using PHP script]]></category>
		<category><![CDATA[mysql database in php]]></category>
		<category><![CDATA[php code to create database and table]]></category>
		<category><![CDATA[PHP MySQL Create Database]]></category>
		<category><![CDATA[selecting a database in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4497</guid>

					<description><![CDATA[&#160; Database is a collection of inter-related data which helps in insertion, retrieval and deletion of data from database and organizes the data in the form of views, tables, reports, schemas etc. For example, institute database organizes the data about students, admin, faculty, and staff etc. which helps in insertion, efficient retrieval and deletion of [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4504" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1.png" alt="" width="882" height="487" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1.png 882w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1-300x166.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1-768x424.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1-390x215.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1-820x453.png 820w" sizes="(max-width: 882px) 100vw, 882px" /></p>
<ul>
<li style="text-align: justify;">Database is a collection of inter-related data which helps in insertion, retrieval and deletion of data from database and organizes the data in the form of views, tables, reports, schemas etc.</li>
<li style="text-align: justify;">For example, institute database organizes the data about students, admin, faculty, and staff etc. which helps in insertion, efficient retrieval and deletion of data from it.</li>
<li style="text-align: justify;">In MySQL we need to create a database to execute a query.</li>
<li style="text-align: justify;">MySQL is an open-source relational database management system and it is distributed, supported and developed by Oracle Corporation.</li>
<li style="text-align: justify;">MySQL is a database system that runs on a server and it is ideal for both small and large applications.</li>
<li style="text-align: justify;">From <a href="https://www.wikitechy.com/php/">PHP</a> script establish a connection to MySQL server.</li>
<li style="text-align: justify;">Write a <a href="https://www.wikitechy.com/tutorials/sql/">SQL</a> query to create a database and store it in a string variable then execute the queries.</li>
<li style="text-align: justify;">Using <strong>Object-oriented</strong> procedure, we can use the query () function of MySQLi class to execute our query.</li>
<li style="text-align: justify;">Using <strong>procedural</strong> procedure, we can use the mysqli_query () function of PHP to execute our query.</li>
<li style="text-align: justify;">Using <strong>PDO</strong> procedure then we can execute our query.</li>
</ul>
<h2 id="sample-code">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/>$servername = &quot;localhost&quot;;<br/>$username = &quot;username&quot;;<br/>$password = &quot;password&quot;;<br/><br/>// Creating a connection<br/>$conn = new mysqli($servername, $username, $password);<br/>// Check connection<br/>if ($conn-&gt;connect_error) {<br/>    die(&quot;Connection failed: &quot; . $conn-&gt;connect_error);<br/>} <br/>// Creating a database named newDB<br/>$sql = &quot;CREATE DATABASE newDB&quot;;<br/>if ($conn-&gt;query($sql) === TRUE) {<br/>    echo &quot;Database created successfully with the name newDB&quot;;<br/>} else {<br/>    echo &quot;Error creating database: &quot; . $conn-&gt;error;<br/>}<br/><br/>// closing connection<br/>$conn-&gt;close();<br/>?&gt;</code></pre> </div>
<h2 id="output">Output</h2>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4498" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql.png" alt="" width="1180" height="625" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql.png 1180w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql-300x159.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql-1024x542.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql-768x407.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql-390x207.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql-820x434.png 820w" sizes="(max-width: 1180px) 100vw, 1180px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/how-to-create-a-database-using-php-and-mysql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
