PHP How to Check if a Key Exists in Associative Array

October 20th, 2011 by Regaz

PHP 5 Check if Key Exist in Assoc Array




If you have an Array $kvarray of Pairs Key-Value and the Key is stored in the $key Variable you Check if it’s present in the Array’s Index by the function:

array_key_exists($key, $kvarray)

Tags: