public static function PHPExcel_Calculation_Logical::LOGICAL_AND in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Logical.php \PHPExcel_Calculation_Logical::LOGICAL_AND()
* LOGICAL_AND * * Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE. * * Excel Function: * =AND(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 AND of the arguments.
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Logical.php, line 103
Class
- PHPExcel_Calculation_Logical
- PHPExcel_Calculation_Logical
Code
public static function LOGICAL_AND() {
// Return value
$returnValue = TRUE;
// 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;
}