PHP Code : How to Check If Key Array Is Exist

5:02 PM | , , , , , , ,

Check if key array is exist with function array_key_exists

Syntax
bool array_key_exists ( mixed $key , array $array )
array_key_exists() returns TRUE if the given key is set in the array. key can be any value possible for an array index.

<?php
$search_array 
= array('first' => null'second' => 4);
// returns falseisset($search_array['first']);
// returns truearray_key_exists('first'$search_array);?>

0 comments:

Post a Comment

Please leave a comment