1. Whether an element exists in the array:
Echo '
Array Operation 1:in_array ($value, $array, $type) ';//$type: Whether the value of $value is type-matched True/false, the default value is False $arr =array ("name" = "DOOR ",";(in_array ("+", $arr))? $v = "exists": $v = "does not exist"; echo "
". $v;
Code Run Result:
Operation of the array 1:in_array ($value, $array, $type) exists
2. Specify whether the key value exists in the array:
Echo '
The operation of the array 2:array_key_exists ($key, $array) ';//The key value of element 32 is 0, the lookup key value is "0", there is no strict type matching $arr=array ("name" = "DOOR", "+"); if (array _key_exists ("0", $arr)) {echo "
Exist ";}
Code Run Result:
Operation of the array 2:array_key_exists ($key, $array) exists
Summary: In_array and array_key_exists matching are case-sensitive.
The above introduces the array array ' find ' operation, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.