Changing Variable Values in PHP
A variable's value is not something rigidly attached to it. We can freely write some data into a variable, read it, then write something else - and so on. See the example:
<?php
$a = 1; // writing the value 1 to the variable
echo $a; // will output 1
$a = 2; // now writing the value 2, overwriting the value 1
echo $a; // will output 2
?>
Create a variable $a
. Write
the value 10
into it, output it to the screen.
Then write the value 20
into it,
and output it to the screen.