Variables in PHP

How we Use Variables in PHP

In Computer programming the variable are that memory location where the constant values are store. You can store your values on that memory location for the purpose of further manipulation in your program.
for example
marks
you can also assign the value like :
marks=200
In PHP programming we must care of two thing. First variable must be declare with $ dollar sign at the beginning.
For example:
$marks = 200
Second thing as a semi-colon ( ; ) at the end of the statement.
$marks = 200;
If you get some error then first check the semi-colon at the end of statement. The next thing to check dollar sign before the variable name.
You can also assign the text value to your variables. For example Name or Address or anything in text format .
$name = "Tanvir";
When you assign the text value the this text must be enclose in double quotes or in single quotes.
$name = " Tauqeer "; or $name = ' Tauqeer ';
Don't use quotes like this:
$name = ' Tauqeer ";

Execution of PHP code

First of all installed Wampserver. This will create server on your PC and you will run PHP code. You can also install XAMPP software. which run the Apache server and SQL server. So that you can test your PHP code with SQL connection.
Now we take an complete example of PHP variable


<html>

<head>

 <title>Variable Practice File</title> </head> <body>

<?php

$name="My Name is Tanvir" ;

echo $name ;

</body>

</html>

After typing this test code in any text editor for example in Notepad in window then save the page as variables.php in C:\xampp\htdocs.
Now Then Run this script by typing the following line in your browser.
http://localhost/variables.php
Now we little describe the Above Code. PHP code is always written in between <?php  and  ?>
echo statement is used to display anything on the page. You can also use print command for this purpose for example: print ($name) ;