Sunday 11 January 2015

USING VARIABLE AND OPERATORS

Storing data in variables

A variable is simple a container that's used to store data both numeric and non-numeric information. and just as with any container, you can move it from place to place to place,add stuff to it or empty it.
In the php language you not need to assign  variable declaration and what type of data is holding.

         $num=100;
  $fnum=100.0;
  $str="Hello"; 
$num variable holding integer value
$fnum variable holding floating value
$str variable holding string value

String can hold letters,numbers and special characters.
String value must be enclosed either in single quotes or double quotes.

eg:-

<?php
$id=103;
$name="lakshya";
$salary= 39099.45;
$y=null; // you can also encounter the null data type
echo $id;
echo $name;
echo $salary;
echo $y;
?>



No comments:

Post a Comment