You are here

public static function PHPExcel_Calculation_Statistical::MAXA in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php \PHPExcel_Calculation_Statistical::MAXA()

* MAXA * * Returns the greatest value in a list of arguments, including numbers, text, and logical values * * Excel Function: * MAXA(value1[,value2[, ...]]) * * @access public * @category Statistical Functions *

Parameters

mixed $arg,... Data values: * @return float

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php, line 2165

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function MAXA() {

  // Return value
  $returnValue = null;

  // Loop through arguments
  $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
  foreach ($aArgs as $arg) {

    // Is it a numeric value?
    if (is_numeric($arg) || is_bool($arg) || is_string($arg) && $arg != '') {
      if (is_bool($arg)) {
        $arg = (int) $arg;
      }
      elseif (is_string($arg)) {
        $arg = 0;
      }
      if (is_null($returnValue) || $arg > $returnValue) {
        $returnValue = $arg;
      }
    }
  }

  // Return
  if (is_null($returnValue)) {
    return 0;
  }
  return $returnValue;
}