Friday, 26 June 2015

PHP: Primitive Types and Checking Functions

Type determines the way that data can be managed in your scripts. You use the string type to display character data, for example, and manipulate such data with string functions. Integers are used in mathematical expressions; Booleans are used in test expressions, and so on. These categories are known as primitive types.
Primitive Types and Checking Functions in PHP
Type Checking Function     Type     Description
is_bool()     Boolean     One of the two special values true or false
is_integer()     Integer     A whole number
is_double()     Double     A floating point number (a number with a decimal point)
is_string()     String     Character data
is_object()     Object     An object
is_array()     Array     An array
is_resource()     Resource     A handle for identifying and working with external resources such as databases or files
is_null()     Null     An unassigned value

Checking the type of a variable can be particularly important when you work with method and
function arguments.

0 comments:

Post a Comment