PHP Programing language

adplus-dvertising
Assignment Operator Examples
Previous Home Next

The main assignment operator is the = operator, which just assigns a value, like this, which stores the value 99 in $bottles_of_water_on_the_wall.


<html>
<head>
<title>Assighment operator</title>
</head>
<body>
<?php
$a = 3;
$b = &$a; // $b is a reference to $a
print "$a\n"; // prints 3
print "$b\n"; // prints 3
$a = 4; // change $a
print "$a\n"; // prints 4
print "$b\n"; // prints 4 as well, since $b is a reference to $a, which has
              // been changed<br />
?>
</body>
</html>
output
3 3 4 4
Previous Home Next