PDOStatement::columnCount

Returns the number of columns in the result set

Use PDOStatement::columnCount to return the number of columns in the result set represented by the PDOStatement object.