Although the documentation says that using that function is preferred than using SET NAMES, it is not sufficient in case you use a collation different from the default one:
<?php
// That will reset collation_connection to latin1_swedish_ci
// (the default collation for latin1):
$mysqli->set_charset('latin1');
// You have to execute the following statement *after* mysqli::set_charset()
// in order to get the desired value for collation_connection:
$mysqli->query("SET NAMES latin1 COLLATE latin1_german1_ci");