You are here

public static function PHPExcel_Calculation_Functions::flattenArray in Loft Data Grids 7.2

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

* Convert a multi-dimensional array to a simple 1-dimensional array * *

Parameters

array $array Array to be flattened: * @return array Flattened array

65 calls to PHPExcel_Calculation_Functions::flattenArray()
PHPExcel_Calculation::calculateCellValue in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php
* Calculate the value of a cell formula * * @access public *
PHPExcel_Calculation::_processTokenStack in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php
PHPExcel_Calculation::_showTypeDetails in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php
* Format type and details of an operand for display in the log (based on operand type) * *
PHPExcel_Calculation::_showValue in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php
* Format details of an operand for display in the log (based on operand type) * *
PHPExcel_Calculation_DateTime::NETWORKDAYS in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* NETWORKDAYS * * Returns the number of whole working days between start_date and end_date. Working days * exclude weekends and any dates identified in holidays. * Use NETWORKDAYS to calculate employee benefits that accrue based on the number…

... See full list

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Functions.php, line 598

Class

PHPExcel_Calculation_Functions
PHPExcel_Calculation_Functions

Code

public static function flattenArray($array) {
  if (!is_array($array)) {
    return (array) $array;
  }
  $arrayValues = array();
  foreach ($array as $value) {
    if (is_array($value)) {
      foreach ($value as $val) {
        if (is_array($val)) {
          foreach ($val as $v) {
            $arrayValues[] = $v;
          }
        }
        else {
          $arrayValues[] = $val;
        }
      }
    }
    else {
      $arrayValues[] = $value;
    }
  }
  return $arrayValues;
}