PHP variables

PHP variable :-

  • php is loosely typed, like javascript
  • i.e. no need to declare variables
  • variables are always prefixed by $ symbol
  • no need to  define type

Example


<?php

$a=255;

$b =10.5;

$c  = "hello";

?>

variable $a hold  value  255 and 255 is  integer therfore its type is integer, variable $b hold  value  10.5 and 10.5 is  decimal therfore its type is decimal, and variable $c hold  value  hello and hello is  string therfore its type is string string allowes written inside single or double v quotes.

 

Post Tags:

PHP variables