You should use the PHP function in_array (see http://php.net/manual/en/function.in-array.php).
if (!in_array($value, $array))
{
$array[] = $value;
}
This is what the documentation says about in_array:
Returns TRUE if needle is found in the array, FALSE otherwise.