Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is the difference between isset and array_key_exists in PHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 137
    Comment on it

    Hello Everyone today I guide you "What is the difference between isset and array_key_exists in PHP"

    The below example helps you to differentiate between isset() and array_key_exists() . isset() will only return true or false array_key_exists() will return the key and its value

    <?php
    
    $newdata = array('key1' => 'Hello, 'key2' => null);
    
    isset($newdata['key1']);             // true
    array_key_exists('key1', $newdata);  // true
    
    isset($newdata['key2']);             // false
    array_key_exists('key2', $newdata);  // 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: