in_array comparing two arrays possible?

I am trying to limit the output of the combo box, so it does not add the options with the $id that matches the numbers in the array $nid. This is through the harvest (time tracking) API, although the main question is can you use in_array to compare two arrays or do you need to use another command?

<?php

if(file_exists('HarvestAPI.php')){
 require_once('HarvestAPI.php');
} else {
    echo 'Cannot load HarvestAPI.php';
}


/* Register Auto Loader */
spl_autoload_register(array('HarvestAPI', 'autoload'));

$api = new HarvestAPI();
$api->setUser('email@address.com');
$api->setPassword('password');
$api->setAccount('account');

$api->setSSL(true);
$nid= array('604695', '604697', '604696', '604698');

?>
<html>
    <form action="testvar.php" method="post">
            <body>

<?
    
    $result = $api->getTasks();
            if( $result->isSuccess() ) {
            #print_r($result->data); exit();
            echo '<select name="task" id="tid">';

                foreach($result->data as $tasks) {
                    unset($id,$name);
                    $id = $tasks->get("id");
                    $name = $tasks->get("name");
                        if(in_array($nid, $id)){
                        echo '<option value="'.$id.'">'.$name.'</option>';
                        
                    }
                }
                echo '</select>';
                echo '<input type="submit" value="Submit" />';                   
                
}

?>

          </body>
    </form>
</html>

Thank you!
Aaron

Thanks for the reply! I actually figured out the issue. It needs to be switched so it is in_array($id, $nid); because it should be ($needle, $haystack) and I was thinking the $id was in an array but it is just looking at the single value each time in the for each loop.

HI i think in_array accepts parameter as in_array(value, array), which you have done wrong.
You can use array_diff to compare two arrays.
Or you can also check other array functions here:
http://php.net/manual/en/ref.array.php