Showing posts with label PHP is_null. Show all posts
Showing posts with label PHP is_null. Show all posts

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.

Friday, 3 October 2014

is_null in PHP

is_null — Finds whether a variable is NULL


Syntax: 
bool is_null ( mixed $var )

Finds whether the given variable is NULL.
Parameters: 

var

    The variable being evaluated.

Return Values:

Returns TRUE if var is null, FALSE otherwise.
Examples:

Example #1 is_null() example
<?php

error_reporting(E_ALL);

$foo = NULL;
var_dump(is_null($inexistent), is_null($foo));

?>

Notice: Undefined variable: inexistent in ...
bool(true)
bool(true)