public static function PHPExcel_Calculation_TextData::FIXEDFORMAT in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/TextData.php \PHPExcel_Calculation_TextData::FIXEDFORMAT()
* FIXEDFORMAT * *
Parameters
mixed $value Value to check: * @param integer $decimals * @param boolean $no_commas * @return boolean
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ TextData.php, line 304
Class
- PHPExcel_Calculation_TextData
- PHPExcel_Calculation_TextData
Code
public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = FALSE) {
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
$decimals = PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
$no_commas = PHPExcel_Calculation_Functions::flattenSingleValue($no_commas);
// Validate parameters
if (!is_numeric($value) || !is_numeric($decimals)) {
return PHPExcel_Calculation_Functions::NaN();
}
$decimals = floor($decimals);
$valueResult = round($value, $decimals);
if ($decimals < 0) {
$decimals = 0;
}
if (!$no_commas) {
$valueResult = number_format($valueResult, $decimals);
}
return (string) $valueResult;
}