-
- 20 PHP Programs
- Sum of Digits
- Even Odd
- Prime Number
- Table of Number
- Factorial
- Armstrong Number
- Palindrome Number
- Fibonacci Series
- Reverse Number
- Reverse String
- Swapping Two Numbers
- Adding Two Numbers
- Subtracting Two Numbers
- Area of a Triangle
- Area of Rectangle
- Leap Year
- Alphabet Triangle Method
- Alphabet Triangle
- Number Triangle
- Star Triangle
-
- PHP Array
- PHP Indexed Array
- PHP Associative Array
- Multidimensional Array
- PHP Array Functions
- PHP array_arsort() Function
- PHP Array asort() Function
- PHP Array changekeycase() Function
- PHP Array Chunk() Function
- PHP Array column() Function
- PHP Array combine() Function
- PHP Array compact() Function
- PHP Array count() Function
- PHP Array count_values() Function
- PHP Array current() Function
- PHP array_diff_assoc() Function
- PHP array_diff() Function
- PHP array_diff_key() Function
- PHP array_diff_uassoc() Function
- PHP array_diff_ukey() Function
- PHP array each() Function
- PHP array end() Function
- PHP array extract() Function
- PHP array_fill() Function
- PHP array_fill_keys() Function
- PHP array_filter() Function
- PHP array flip() Function
- PHP in_array() Function
- PHP array_intersect_assoc() Function
- PHP array_intersect() Function
- PHP array_intersect_key() Function
- PHP array_intersect_uassoc() Function
- PHP array_intersect_ukey() Function
- PHP array_key_exists() Function
- PHP array_key_first() Function
- PHP array_key() Function
PHP array_key_exists() Function
The array_key_exists() function checks if a specified key exists in an array. It returns true
if the key is found, otherwise false
.
Key Features of array_key_exists()
- Checks for the presence of a specific key in an array.
- Works with both associative and indexed arrays.
- Returns a boolean value (true or false).
Syntax of array_key_exists()
Syntax
bool array_key_exists(mixed $key, array $array);
Example Using array_key_exists()
The following example demonstrates how array_key_exists()
is used:
Example
$array = ["language" => "PHP", "framework" => "Laravel"];
if (array_key_exists("framework", $array)) {
echo "Key 'framework' exists in the array!";
} else {
echo "Key 'framework' does not exist.";
}
Output
Key 'framework' exists in the array!
← Previous Topic
array_intersect_ukey()
array_key_first()
Next Topic →