Variables and basic types

PHP variables start with $. Use gettype() or var_dump() to see the type.

PHP · Variables and basic typesBeginner
$name  = 'Ali';        // string
$age   = 30;           // int
$price = 19.99;        // float
$ok    = true;         // bool
$list  = [1, 2, 3];    // array
$none  = null;         // null

echo gettype($name), ' ', gettype($age), ' ', gettype($price), ' ', gettype($list);
variablestypesbasics