101, 'name' => 'Alice', 'email' => 'alice@example.com' ]; // Checking if a key exists using isset (works for both existing keys with null/0 values and non-existing keys) // Will return false if key 'age' does not exist or its value is null. if (isset($user['age'])) { echo "User age is: " . $user['age'] . " "; } else { echo "User age is not set (using isset). "; } // Checking if a key exists using array_key_exists (true even if value is null) // Will return true if key 'email' exists, even if its value were null. if (array_key_exists('email', $user)) { echo "User email is: " . $user['email'] . " "; } else { echo "User email is not set (using array_key_exists). "; } // Accessing with null-coalescing operator (PHP 7.0+) for a default value $city = $user['city'] ?? 'Unknown'; echo "User city: " . $city . " "; // Example with a nullable value $profile = [ 'username' => 'john_doe', 'bio' => null ]; if (isset($profile['bio'])) { echo "User bio is: " . $profile['bio'] . " "; // This will not execute } else { echo "User bio is not set or null (using isset). "; // This will execute } if (array_key_exists('bio', $profile)) { echo "User bio exists: " . ($profile['bio'] ?? 'N/A') . " "; // This will execute } else { echo "User bio does not exist (using array_key_exists). "; } ?>