/***********array_key_exists(检查键名或索引是否在数组中)*****************/ $arr1 = array('name' => 'Sheldon', 'age' => 30, 'address' => 'Carlifornia'); if (array_key_exists('name', $arr1)) { echo 'the name element is in the array.'; } else { echo 'name elment not exist.'; }
Check if there is a key named 'name' in $arr1.
Also check the numerical index.