note 130152 added to function.array-key-exists
| From: | developerxyz852@gmail.com | Date: | Tue, 18 Mar 2025 05:44:38 +0000 |
| Subject: | note 130152 added to function.array-key-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221984@lists.php.net to get a copy of this message | ||
<?php
// Define an associative array
$userProfile = [
'name' => 'John Doe',
'email' => 'john.doe@example.com',
'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.";
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 182.184.18.191)
----
Manual Page -- https://php.net/manual/en/function.array-key-exists.php
Edit -- https://main.php.net/note/edit/130152
Del: integrated -- https://main.php.net/note/delete/130152/integrated
Del: useless -- https://main.php.net/note/delete/130152/useless
Del: bad code -- https://main.php.net/note/delete/130152/bad+code
Del: spam -- https://main.php.net/note/delete/130152/spam
Del: non-english -- https://main.php.net/note/delete/130152/non-english
Del: in docs -- https://main.php.net/note/delete/130152/in+docs
Del: other reasons-- https://main.php.net/note/delete/130152
Reject -- https://main.php.net/note/reject/130152
Search -- https://main.php.net/manage/user-notes.php