Showing posts with label variable in php. Show all posts
Showing posts with label variable in php. Show all posts

Friday, 17 May 2013

Lesson 2- Variable in PHP


Variable in PHP

In programming variable is a storage location where data will be stored. In php we declared variable using $(Dollar) symbol.

For Example:-

Declaration of variable:-

$var_data

Note:-var_data is a variable name. it can be anything.

Assign value to the variable:-

$var_data=”isha Malhotra”;

You can also declare and assign value in single line.

Basic program to work with variable and learn more about echo
<?php
$data;
$data="isha Malhotra";
echo "$data";
?>

When I execute this program it will show the following output:-



Figure 1