php type related functions

A few functions are available for both verifying and converting datatypes. they are covered in this section.

Retrieving Types :

The gettype() function returns the type of the variable specified by var. In total, eight possible return values are available: array, boolean, double, integer, object, resource, string, and unknown type.Its prototype follows:

string gettype (mixed var)

Converting Types :

The settype() function converts a variable, specified by var, to the type specified by type. Seven possible type values are available: array, boolean, float, integer, null, object, and string. If the conversion is successful, TRUE is returned; otherwise, FALSE is returned. Its prototype follows:

boolean settype(mixed var, string type)