<?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>How to declare PHP variable Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/how-to-declare-php-variable/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/how-to-declare-php-variable/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Wed, 21 Jul 2021 13:20:20 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Tutorials for PHP Variables</title>
		<link>https://www.scmgalaxy.com/tutorials/tutorials-for-php-variables/</link>
					<comments>https://www.scmgalaxy.com/tutorials/tutorials-for-php-variables/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Wed, 21 Jul 2021 13:20:18 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[How]]></category>
		<category><![CDATA[How to declare PHP variable]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[PHP Variables]]></category>
		<category><![CDATA[Types of Variable]]></category>
		<category><![CDATA[Variable Initialization]]></category>
		<category><![CDATA[What]]></category>
		<category><![CDATA[What are the Types of Variable]]></category>
		<category><![CDATA[What is Variable]]></category>
		<category><![CDATA[Why]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=6865</guid>

					<description><![CDATA[<p>What is Variable? In any programming language, a variable is a computer memory name that represents knowledge. One of the [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorials-for-php-variables/">Tutorials for PHP Variables</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">What is Variable?</h2>



<p class="wp-block-paragraph">In any programming language, a variable is a computer memory name that represents knowledge. One of the numerous computer program components is the variables. For declare a variable in php, the <code><span class="has-inline-color has-vivid-red-color"><strong>$</strong></span></code> sign with its signature, like <code><span class="has-inline-color has-vivid-red-color"><strong>$myVariable</strong></span></code>, can be used.</p>



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



<h3 class="wp-block-heading">How to declare PHP variable?</h3>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="889" height="500" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/PHP-Variable-Decleare.jpg" alt="" class="wp-image-6887" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/PHP-Variable-Decleare.jpg 889w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/PHP-Variable-Decleare-300x169.jpg 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/PHP-Variable-Decleare-768x432.jpg 768w" sizes="(max-width: 889px) 100vw, 889px" /></figure>



<ul class="wp-block-list"><li>All variables in PHP start with a $(doller) sign followed by the name of the variable.</li><li>A valid Variable name starts with a letter (A-Z, a-z) or underscore(_), followed by any number of letters, numbers, or underscores.</li><li>If a variable name is more than one word, it can be separated with underscore(for example $employee_code instead of $employeecode).</li><li>&#8216;$&#8217; is a special variable that can not be assigned.</li></ul>



<h3 class="wp-block-heading">What are the Types of Variable?</h3>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="550" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/PHP-Variable-1024x550.jpg" alt="" class="wp-image-6886" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/PHP-Variable-1024x550.jpg 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/PHP-Variable-300x161.jpg 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/PHP-Variable-768x413.jpg 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/PHP-Variable.jpg 1366w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph"><strong>Local Variables</strong>:- A local variable is one that only exists inside a certain scope. They only exist in the function in which they were created. They&#8217;re frequently referred to as automatic variables since they&#8217;re produced automatically when the function starts running and disappear immediately when it&#8217;s completed. The term auto can be used to create these variables explicitly, but it isn&#8217;t required because auto is the default.</p>



<p class="wp-block-paragraph"><strong>Global Variables</strong>:- A global variable is one that is defined outside of all functions and is accessible to all of them. These variables are unaffected by scopes and are always accessible, implying that a global variable persists until the program is terminated. It&#8217;s possible to make a global variable in one file and use it in another. The variable must be defined in both files to do this, but the term extern must come before the &#8220;second&#8221; declaration.</p>



<p class="wp-block-paragraph"><strong>Static Variables</strong>:- A global or local variable can be a static variable. Both are generated by using the term static before the variable definition. A local static variable is one that can keep its value from one function call to the next and will persist until the program is finished. When creating a local static variable, it should be given an initial value. If it isn&#8217;t, the value will be set to 0 by default. A global static variable may only be accessed within the file in which it was created. File scope is a term used to describe a variable&#8217;s scope.</p>



<h2 class="wp-block-heading"><strong>Variable Initialization</strong>?</h2>



<p class="wp-block-paragraph">PHP can store all type of data in variables. Before using a variable in PHP, assign a value to it so PHP will create that variable and store data in it. That means we have to assign data to a variable before attempting to read a variable’s value.</p>



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



<pre class="wp-block-code"><code>$roll = 256;
$price = 25.50;
$name = “Geeky Shows”;
Note - If a variable is created without a value, it is automatically assigned a value of NULL.</code></pre>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorials-for-php-variables/">Tutorials for PHP Variables</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/tutorials-for-php-variables/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
