public static function PHPExcel_Calculation_LookupRef::COLUMNS in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/LookupRef.php \PHPExcel_Calculation_LookupRef::COLUMNS()
* COLUMNS * * Returns the number of columns in an array or reference. * * Excel Function: * =COLUMNS(cellAddress) * *
Parameters
cellAddress An array or array formula, or a reference to a range of cells for which you want the number of columns: * @return integer The number of columns in cellAddress
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ LookupRef.php, line 152
Class
- PHPExcel_Calculation_LookupRef
- PHPExcel_Calculation_LookupRef
Code
public static function COLUMNS($cellAddress = Null) {
if (is_null($cellAddress) || $cellAddress === '') {
return 1;
}
elseif (!is_array($cellAddress)) {
return PHPExcel_Calculation_Functions::VALUE();
}
$x = array_keys($cellAddress);
$x = array_shift($x);
$isMatrix = is_numeric($x);
list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
if ($isMatrix) {
return $rows;
}
else {
return $columns;
}
}