如何使用函数创建预准备语句

I am new to these prepared statements (all my code so far has been procedural), and I was trying to create a function for executing prepared statements so I could save time writing a statement for every SQL query I need.

function executeQuery($stmt,$mysqli,$sql,$type,$param1,$param2,$param3){
    $stmt = $mysqli -> stmt_init();
    $stmt = $mysqli -> prepare($sql);
    $stmt->bind_param($type,$param1,$param2,$param3);
    $stmt->execute();
    $stmt->close();
}

As you can see, my issue is that I would need a different function for prepared statements that only deal with 1 parameter in the query, one for 2 parameters, another for 3 and so on. I thought of making $param an array but I don't think that quite works.

Any ideas?