Check connection closed

4

How can I check if a connection has actually been closed?

    $con = new Conexao();
    $con->abrirConexao();
    ...
    $con->fecharConexao();

I use a variable to instantiate the Conexao class that is in another file. I would just like to know how I can check if the fecharConexão() method actually closed the previously opened connection.

My method to close the connection is this:

public function fecharConexao(){
    return mysqli_close($this->conexao);          
}

I would just like a notification (just so I know) that the connection is terminated. How do I do this?

    
asked by anonymous 19.11.2015 / 04:29

1 answer

3

The function mysqli_close() returns Boolean value

true : indicates successful execution

false : indicates that there was an error.

Basically, just check the return value.

If you return true , the connection has been closed.

    
19.11.2015 / 04:53