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