Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Difference between array_key_exits and isset in array

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 505
    Comment on it

    Hello Reader we almost have header about array_key_exits and isset but you need to know the diffrence between them. Lets take an example below:- array_key_exists will only work when your key have an element and doesnt matter it is null, but isset will only return true if the key/variable exists and is not null.

    $myArray = array('key1' => 'first', 'key2' => null);
    
    isset($a['key1']);             // return **true**
    array_key_exists('key1', $myArray );    // return **true**
    
    isset($a['key2']);             // here return is **false**, because key is null
    array_key_exists('key2', $myArray );   // return **true**
    

 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: