CodesJava

Easy learning with example program codes

php-dollar-doubledollar


PHP $ Variable:

The single dollar PHP Variables ($x, where x is the variable name) are the normal variables that temporarily stores its data to a memory location.

PHP $$ Variable:

The double dollar PHP Variables ($$x, where x is the variable name) are the reference variables that are used to store the value of the single dollar variable ($x) inside it.

Example 1: Printing values of $ Variable, $$ Variable and value of $ variable using PHP Echo Statement

<!DOCTYPE html>
<html>
<body>
 
<?php
 
$v = "xyz";  
$$v = 500;  
 
echo $v. "<br>";
echo $$v. "<br>";
echo $xyz;
 
?>
 
</body>
</html>

Example 2: Printing value of $ and $$ Variables in a single message.

<!DOCTYPE html>
<html>
<body>
 
<?php
 
$v = "xyz";  
$$v = 500;  
 
echo $v. "<br>";
echo $$v. "<br>";
echo "Value of $v is:” .$$v;
 
?>
 
</body>
</html>
Posted in PHP   
Sign Up/ Sign In
Ask a Question


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki