I want to know is this practically possible in sql(using php as server-side), where in you have an array of values(numbers), and you try to retrieve data based on values ins
SQL can't parse PHP arrays. Try this:
$query="SELECT * FROM posts WHERE user_id IN ({implode(',', $userIDarray)})";