Introduction :
PHP supports eight primitive types.
Four scalar types: 1) boolean, 2) integer, 3) float, 4) string
Two compound types: 1) array, 2) object
Two special types: 1) resource, 2) NULL
Pseudo-types: 1) mixed, 2) number, 3) callback
To check the type and value of an expression, use the var_dump() function. To get a human-readable representation of a type for debugging, use the gettype() function. To check for a certain type, do not use gettype(), but rather the is_type functions.
PHP takes care of converting between data types transparently when a datum is used in an expression. However, it is still possible to force the conversionof a value to a specific type using type conversion operators. These are simply the names of the data type you want to convert to enclosed in brackets and placed before an expression. For example:
$x = 5.55;
echo (int) $x; // Outputs 5
Note that a value cannot be converted to some special types; for example, you cannot convert any value to a resource—you can, however, convert a resource to a numeric or string data type, in which case PHP will return the numeric ID of the resource, or the string Resource id # followed by the resource ID.
Posted by lifos