Variables can store different types of data. A data type is a set of values and the allowable operations on those values.

1. Scalar types:

  1. boolean - Represents true or false. Ex: $logged_in = true.
  2. integer -  Numbers without decimal points. Ex: $age = 25.
  3. float - Numbers with decimal points. Ex: $price = 10.99.
  4. string - Sequence of characters. Ex: $name = “tutorialsonweb”.

2. Compound types

  1. array - It Represents a collection of values and indexed by keys. Ex: $fruits = array("apple", "banana", "orange");
  2. object -  Represents an instance of a class
<?php 
class Person {
    public $name;
    public $age;
}
$person = new Person();
$person->name = "tutorialsonweb";
$person->age = 25;
?>

3. Special types

  1. resources
  2. NULL -  Represents a variable with no value assigned. Ex: $var_name = null;