Variables and types

A PHP variable starts with $ and gets its type from the value it holds. The basic types are int, float, string, bool, array and null. PHP sometimes converts types automatically, which can be surprising; var_dump lets you inspect type and value.

Example

$age = 30;
$nom = 'Léa';
var_dump($age);

Related concepts

The whole glossary