isset(), empty(), is_null() are three usefull php functions which are primary used in testing the value of a variable. They all return a boolean value. Distinguishing the difference among these three functions are quiet important as misusing either one might introduce bug in your application.

1. isset()

This function is mostly used to test incoming variables such as form input variables. It returns true only is the variable is not null.

2. empty()

empty() returns true if the variable is not empty, meaning not one of the following: “”, “0″,0,false,array(),null.

3. is_null()

is_null() returns true if the variable is null. is_null() is the opposite of isset()


Function Comparision

function return true if $var is
isset($var) anything other than null
empty($var) “0″, “”, false, 0, array(), null, unassigned
is_null($var) null