public function getMatchingColumns($table1, $which_connection1, $table2, $which_connection2)
    {
        $def1 = $this->tableDefinition($table1, $which_connection1);
        $def2 = $this->tableDefinition($table2, $which_connection2);
        $ret = array_reduce(array_keys($def1),
            function ($carry, $column_name) use ($def2) {
                if (isset($def2[$column_name])) {
                    $carry .= $column_name . ',';
                }
                return $carry;
            },
            ''
        );
                
        if ($ret === '') {
            return false;
        } else {
            return substr($ret, 0, strlen($ret)-1);
        }
    }
public function getMatchingColumns($table1, $which_connection1, $table2, $which_connection2)
    {
        $def1 = $this->tableDefinition($table1, $which_connection1);
        $def2 = $this->tableDefinition($table2, $which_connection2);
        $ret = array_reduce(array_keys($def1),
            function ($carry, $column_name) use ($def2) {
                if (isset($def2[$column_name])) {
                    $carry .= $column_name . ',';
                }
                return $carry;
            },
            ''
        );
                
        if ($ret === '') {
            return false;
        } else {
            return substr($ret, 0, strlen($ret)-1);
        }
    }
public function getMatchingColumns ( $ table1 , $ which_connection1 , $ table2 , $ which_connection2 ) { $ def1 = $ this -> tableDefinition ( $ table1 , $ which_connection1 ) ; $ def2 = $ this -> tableDefinition ( $ table2 , $ which_connection2 ) ; $ ret = array_reduce ( array_keys ( $ def1 ) , function ( $ carry , $ column_name ) use ( $ def2 ) { if ( isset ( $ def2 [ $ column_name ] ) ) { $ carry .= $ column_name . ',' ; } return $ carry ; } , '' ) ; if ( $ ret === '' ) { return false ; } else { return substr ( $ ret , 0 , strlen ( $ ret ) - 1 ) ; } }
Get list of columns that exist in both tables
@param $table1 [string] name of first table
@param $which_connection1 [string] name of first database connection
@param $table2 [string] name of second table
@param $which_connection2 [string] name of second database connection
@return [string] list of column names or [boolean] false
Get list of columns that exist in both tables