That's a nice little piece of code right there. I will probably use it in the future.
Although it won't work as is if you are checking strings. I think you could make it work with strings like this:
Code:
$ids = implode("', '", $ids_array);
$query = "SELECT * FROM table WHERE id IN ('".$ids."')";