PHP and MySQL Basics: Assigning and Using Variables
Posted by Daniel at 11:34 pm
Assigning a value to PHP variable is very easy, you can use the assignment operator ( = ) to store values into a php variable. refer below for example.
<html> <head> <title>Assigning Values to PHP Variable</title> </head> <body> <?php //this is how you assign a value to a php variable $age = 20; //To use the variable $age, simply call its name and PHP will substitute its value at runtime. //this is how you use a php variable echo "I am now $age years old"; ?> </body> </html>
copy and paste the code above to your text editor and save it as variable.php then run it on your localhost.
you should get this output..

Wow..Ang galing, ganda ng theme mo bro!