Variables in php: The variable is a component, highlight, or factor that is at risk to differ or change.
variables in php

Example of daily life

no of students in every class is a variable as it is different for every class.

variables in PHP

variables in PHP is declared by "$" sign.

Example

$a, $b etc


you can name the variable whatever you want but it is a common practice to name the variable similar to what is its purpose so it will we easy to understand why it is made if another person sees your code.

variables can be used to store data of any type in PHP, in PHP there is no need to define the type of a variable any variable can store any kind of data.


$variable1=0;                       In this case it is storing a numeric value
$variable1="brainlight";      In this case it is storing a string.

so a variable can store any kind of data.


NOTE: <?php   ?>   all php code is written in there tags in .php file. we will discuss about it when we will move toward code practice..

Previous Lecture