Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Where to use isset() or empty()?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 154
    Comment on it

    isset() and empty() are the function of PHP which are used to check whether the variable contains some value or not.

    The major difference between them is::

    isset() is used when we want to just check whether the variable is set or not. It returns TRUE even if the variables contains value like::
     

    $var = NULL;
    $var = FLASE;
    $var = 0; 
    $var = "";
    $var = "0";

    It will return FALSE in a case like this:
     

    $var;
    isset($var);  //returns false

    Whereas, empty() checks whether the variables is set or not  as well as the truthness of the variable.

    For example empty() will return TRUE if the variable is empty in cases like this::

    $var;  //returns true as this variable is null
    $var = NULL;
    $var = FLASE;
    $var = 0; 
    $var = "";
    $var = "0";

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: