- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
array_key_exists() function in PHP
The array_key_exists() function checks if the specified key exists in the array. The function returns true if the key exists and false if the key does not exist.
Syntax
array_key_exists(key, arr)
Parameters
key − Specify the key to be checked.
arr − The array wherein we will find the key.
Return
The array_key_exists() function returns true if the key exists and false if the key does not exist.
Example
<?php $arr = array("One"=>"Tennis","Two"=>"Football", "Three"=>"Cricket"); if (array_key_exists("Three",$arr)) { echo "Key is in the array!"; } else { echo "Key is not in the array!"; } ?>
Output
Key is in the array!
Advertisements
To Continue Learning Please Login
Login with Google