Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

array_key_exists vs in_array

in_array() v/s array_key_exists()
Difference:

in_array() checks if a value exists in an array (checks the values, not the keys) and returns true, or false otherwise.
while:

array_key_exists() checks if the given key or index exists in the array (checks in keys, not in values) and returns true, or false otherwise.
Visits the manual (links above) for examples and more information.
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
8+4 =