You are here

public static function PHPExcel_Calculation_Logical::LOGICAL_OR in Loft Data Grids 7.2

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

* LOGICAL_OR * * Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE. * * Excel Function: * =OR(logical1[,logical2[, ...]]) * * The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays * or references that contain logical values. * * Boolean arguments are treated as True or False as appropriate * Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False * If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds * the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value * * @access public * @category Logical Functions *

Parameters

mixed $arg,... Data values: * @return boolean The logical OR of the arguments.

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Logical.php, line 158

Class

PHPExcel_Calculation_Logical
PHPExcel_Calculation_Logical

Code

public static function LOGICAL_OR() {

  // Return value
  $returnValue = FALSE;

  // Loop through the arguments
  $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
  $argCount = -1;
  foreach ($aArgs as $argCount => $arg) {

    // Is it a boolean value?
    if (is_bool($arg)) {
      $returnValue = $returnValue || $arg;
    }
    elseif (is_numeric($arg) && !is_string($arg)) {
      $returnValue = $returnValue || $arg != 0;
    }
    elseif (is_string($arg)) {
      $arg = strtoupper($arg);
      if ($arg == 'TRUE' || $arg == PHPExcel_Calculation::getTRUE()) {
        $arg = TRUE;
      }
      elseif ($arg == 'FALSE' || $arg == PHPExcel_Calculation::getFALSE()) {
        $arg = FALSE;
      }
      else {
        return PHPExcel_Calculation_Functions::VALUE();
      }
      $returnValue = $returnValue || $arg != 0;
    }
  }

  // Return
  if ($argCount < 0) {
    return PHPExcel_Calculation_Functions::VALUE();
  }
  return $returnValue;
}