PHP supports eight primitive types.

Four scalar types:

boolean
integer
float (floating-point number, aka double)
string

Two compound types:

array
object

And finally two special types:

resource
NULL

This manual also introduces some pseudo-types for readability reasons:

mixed
number
callback

And the pseudo-variable $....

Some references to the type "double" may remain in the manual. Consider double the same as float; the two names exist only for historic reasons.

The type of a variable is not usually set by the programmer; rather, it is decided at runtime by PHP depending on the…

Leer artículo completo →