Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FetchModeTrait.php

function FetchModeTrait::assocToColumn

Converts a row of data in FETCH_ASSOC format to FETCH_COLUMN.

Parameters

array $rowAssoc: A row of data in FETCH_ASSOC format.

string[] $columnNames: The list of the row columns.

int $columnIndex: The index of the column to fetch the value of.

Return value

string|false The value of the column, or FALSE if the column is not defined.

File

core/lib/Drupal/Core/Database/FetchModeTrait.php, line 105

Class

FetchModeTrait
Provide helper methods for statement fetching.

Namespace

Drupal\Core\Database

Code

protected function assocToColumn(array $rowAssoc, array $columnNames, int $columnIndex) : mixed {
    return $rowAssoc[$columnNames[$columnIndex]] ?? FALSE;
}
RSS feed
Powered by Drupal