如果外部页面输入名称与数组不匹配,则执行其他操作

Lets say I have an array like this. . .

$array = array("username", "password", "token", "redirect", "sid");

what I want to do Is If an Input name doesn't match In the array, else do something with the none matching Input name and value any help would be appreciated.

I think you're trying to filter through the input fields that are not in your array.

If I understand your question correctly, here's how to do it:

$array = array("username", "password", "token", "redirect", "sid");

foreach ( $_POST as $input_name => $value ) {
    if ( ! in_array($input_name, $array) ) {
        // Do something with $value
    }
}

You can use in_array().

if(in_array($myName, $array)) {
   // in the array.
} else {
  // nope.
}

You can find the keys that aren't in $array using this.

$keys = array_keys($_POST);

$invalidKeys = array_merge(array_diff($array, $keys), array_diff($keys, $array));