PHP automatically determines a variable's type based on the value assigned to it. The main types are:
string— Text like"Hello"int— Whole numbers like42or-7float— Decimal numbers like99.95bool—trueorfalsearray— Ordered map/list of valuesobject— Instance of a classnull— Represents an empty/unset value
Use var_dump($var) while debugging to inspect both the exact type and value of any variable.
ADVERTISEMENT