Voting

: two minus zero?
(Example: nine)

The Note You're Voting On

developerxyz852 at gmail dot com
1 month ago
<?php

// Define an associative array
$userProfile = [
'name' => 'John Doe',
'email' => '[email protected]',
'age' => 30,
'country' => 'USA'
];

// Key to check
$keyToCheck = 'email';

// Use array_key_exists to check if the key exists in the array
if (array_key_exists($keyToCheck, $userProfile)) {
echo
"The key '$keyToCheck' exists in the array with value: " . $userProfile[$keyToCheck];
} else {
echo
"The key '$keyToCheck' does not exist in the array.";
}

?>

<< Back to user notes page

To Top