im trying to create a function that allows me to set different types of database connections into the current instance.
I need a logic to detect what are the current types of connection that is being passed in, and only assign them if it's a valid database connection object.
Such as, right now i could use "instanceof MySQLI" because MySQLI is object oriented.
Let's say i now need to check for oracle? oci_connect doesn't look object oriented to me so i can't use instanceof.
public function setConnection($conn){
if(isset($conn)){
if($conn instanceof MySQLI ||
$conn instanceof OCI){
$this->currentConnection = $conn;
}
}
}