You are here

public static function PHPExcel_Calculation_LookupRef::TRANSPOSE in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/LookupRef.php \PHPExcel_Calculation_LookupRef::TRANSPOSE()

* TRANSPOSE * *

Parameters

array $matrixData A matrix of values: * @return array * * Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix.

1 call to PHPExcel_Calculation_LookupRef::TRANSPOSE()
PHPExcel_Calculation_LookupRef::LOOKUP in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/LookupRef.php
* LOOKUP * The LOOKUP function searches for value either from a one-row or one-column range or from an array. *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/LookupRef.php, line 657

Class

PHPExcel_Calculation_LookupRef
PHPExcel_Calculation_LookupRef

Code

public static function TRANSPOSE($matrixData) {
  $returnMatrix = array();
  if (!is_array($matrixData)) {
    $matrixData = array(
      array(
        $matrixData,
      ),
    );
  }
  $column = 0;
  foreach ($matrixData as $matrixRow) {
    $row = 0;
    foreach ($matrixRow as $matrixCell) {
      $returnMatrix[$row][$column] = $matrixCell;
      ++$row;
    }
    ++$column;
  }
  return $returnMatrix;
}