See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 and 403]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical; 4 5 use PhpOffice\PhpSpreadsheet\Calculation\Functions; 6 7 class Maximum extends MaxMinBase 8 { 9 /** 10 * MAX. 11 * 12 * MAX returns the value of the element of the values passed that has the highest value, 13 * with negative numbers considered smaller than positive numbers. 14 * 15 * Excel Function: 16 * MAX(value1[,value2[, ...]]) 17 * 18 * @param mixed ...$args Data values 19 * 20 * @return float 21 */ 22 public static function max(...$args) 23 { 24 $returnValue = null; 25 26 // Loop through arguments 27 $aArgs = Functions::flattenArray($args); 28 foreach ($aArgs as $arg) { 29 // Is it a numeric value? 30 if ((is_numeric($arg)) && (!is_string($arg))) { 31 if (($returnValue === null) || ($arg > $returnValue)) { 32 $returnValue = $arg; 33 } 34 } 35 } 36 37 if ($returnValue === null) { 38 return 0; 39 } 40 41 return $returnValue; 42 } 43 44 /** 45 * MAXA. 46 * 47 * Returns the greatest value in a list of arguments, including numbers, text, and logical values 48 * 49 * Excel Function: 50 * MAXA(value1[,value2[, ...]]) 51 * 52 * @param mixed ...$args Data values 53 * 54 * @return float 55 */ 56 public static function maxA(...$args) 57 { 58 $returnValue = null; 59 60 // Loop through arguments 61 $aArgs = Functions::flattenArray($args); 62 foreach ($aArgs as $arg) { 63 // Is it a numeric value? 64 if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { 65 $arg = self::datatypeAdjustmentAllowStrings($arg); 66 if (($returnValue === null) || ($arg > $returnValue)) { 67 $returnValue = $arg; 68 } 69 } 70 } 71 72 if ($returnValue === null) { 73 return 0; 74 } 75 76 return $returnValue; 77 } 78 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body