Source Code:
(back to article)
<?php // PHP program to illustrate the use // of array_key_exists() function function Exists($index, $array) { if (array_key_exists($index, $array)) { echo "Key Found"; } else { echo "Key not Found"; } } $array = [ "john" => 25, "david" => 10, "jack" => 20, ]; $index = "jack"; print_r(Exists($index, $array)); ?>
Result:
Report an issue