You are here

public static function PHPExcel_Calculation::_getMatrixDimensions in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php \PHPExcel_Calculation::_getMatrixDimensions()

* Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0 * *

Parameters

mixed &$matrix matrix operand: * @return array An array comprising the number of rows, and number of columns

3 calls to PHPExcel_Calculation::_getMatrixDimensions()
PHPExcel_Calculation::_checkMatrixOperands in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php
* Ensure that paired matrix operands are both matrices and of the same size * *
PHPExcel_Calculation_LookupRef::COLUMNS in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/LookupRef.php
* COLUMNS * * Returns the number of columns in an array or reference. * * Excel Function: * =COLUMNS(cellAddress) * *
PHPExcel_Calculation_LookupRef::ROWS in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/LookupRef.php
* ROWS * * Returns the number of rows in an array or reference. * * Excel Function: * =ROWS(cellAddress) * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php, line 2474

Class

PHPExcel_Calculation
PHPExcel_Calculation (Multiton)

Code

public static function _getMatrixDimensions(&$matrix) {
  $matrixRows = count($matrix);
  $matrixColumns = 0;
  foreach ($matrix as $rowKey => $rowValue) {
    $matrixColumns = max(count($rowValue), $matrixColumns);
    if (!is_array($rowValue)) {
      $matrix[$rowKey] = array(
        $rowValue,
      );
    }
    else {
      $matrix[$rowKey] = array_values($rowValue);
    }
  }
  $matrix = array_values($matrix);
  return array(
    $matrixRows,
    $matrixColumns,
  );
}