Get multiple db prefix with $wpdb

Write a function that uses $wpdb->prefix as a fallback. Something like this:

function wpse65880_table_with_prefix($table) {

    // should define array in config file, rather than hard coding
    $my_tables = array("table1", "table2", "table3", "table4");

    if (in_array($table, $my_tables)) {
        // "qa_" should also be a config file setting
        return "qa_" . $table;
    }
    else return $wpdb->prefix . $table;
}

$table_name = wpse65880_table_with_prefix('post');

$titles = $wpdb->get_results("
    SELECT title
    FROM $table_name // reflects current prefix
");