Difference between $var and $$var in PHP Last Updated : 18 Oct, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In PHP, $var is used to store the value of the variable like Integer, String, boolean, character. $var is a variable and $$var stores the value of the variable inside it. $var: Syntax: $variable = value;The $variable is the variable nameThe value is the initial value of the variable. Example 1: This example stores and displays values with $. PHP <?php // String value $value1 = "hello Geeks"; // Display string value echo $value1; echo "<br/>"; // Boolean value $value2 = true; // Display boolean value echo $value2; echo "<br/>"; // Integer value $value3 = 34; // Display integer value echo $value3; echo "<br/>"; ?> Outputhello Geeks<br/>1<br/>34<br/> $$var: $$var stores the value of $variable inside it. Syntax: $variable = "value"; $$variable = "new_value";$variable is the initial variable with the value.$$variable is used to hold another value. We can get another value by using the $value of the first variable. Example 2: PHP program to demonstrates $$var. PHP <?php // String value $value1 = "hello"; // Display string value echo $value1; echo "\n"; // Store another string in $$var $$value1 = "Hello php"; // Access another string using // value of $var echo "$hello"; ?> Outputhello Hello php Difference between Both: The variable $var is used to store the value of the variable and the variable $$val is used to store the reference of the variable. Comment More infoAdvertise with us Next Article Difference between $var and $$var in PHP S sravankumar_171fa07058 Follow Improve Article Tags : Difference Between Web Technologies PHP PHP-basics PHP-Questions Web Technologies - Difference Between +2 More Similar Reads What's the difference between and in PHP ? There are many types of line-ending characters that are used in PHP. They differ depending upon the operating system and editors using them. It's also based on how apps, libraries, protocols, and file formats deal with things. These characters are invisible. \n is used for the newline or linefeed, w 2 min read What is the difference between == and === in PHP ? In this article, we will discuss the differences between '==' and '===' operators in PHP. Both are comparison operators used to compare two or more values. == Operator: This operator is used to check the given values are equal or not. If yes, it returns true, otherwise it returns false. Syntax: oper 2 min read Difference between PHP and C# PHP is the recursive acronym for Hypertext Preprocessor. It is the widely-used general-purpose scripting language that is especially used for web development and embedded into the HTML. Its scripts are executed on the server. Files of PHP contains HTML, CSS, JavaScript and PHP code. It is executed o 2 min read Difference Between Golang and PHP Golang is a statically typed, compiled programming language invented at Google headquarter by Mr. Robert Griesemer, Mr Rob Pike, and Mr. Ken Thompson. Its development began in 2007 and it was made available to the public in the year 2009. It's open-source and freely available for public use. It is m 2 min read What is the difference between Perl and PHP ? PHP: PHP (Hypertext Pre-processor) is a general-purpose programming language used to designed a website or web applications. It is the server-side scripting language embedded with HTML to develop Static website, Dynamic website or Web applications. It is used to interact with database and display th 2 min read Like