PHP。 检查数组中是否存在[Key] => [Value]

I need to check if an array like this:

(["1"] => "30/11/2001 00:00:00" ["302"] => "2001-12-01 00:00:00" ["522"] =>"01/12/2012 00:00:00" ["1"] => "30/11/2001 00:00:00" etc...)

already exists the value pair that I am going to add. If already exists, I want to do some things, otherwise I want to do other things.

How do I find in the array (like the array I wrote) if already exists one or more pairs of values "["key"] => ["value"] ??

You can try:

$tested_key = '302';
$tested_value = '2001-12-01 00:00:00';


if(isset($your_data[$tested_key]) AND $your_data[$tested_key] === $tested_value ){
    echo 'This Key exists with this value';
}

I'm sorry to tell you, you can't have duplicate keys on your array !

See PHP doc :

http://php.net/manual/en/language.types.array.php#example-97