You are here

public static function PHPExcel_Calculation_Functions::N in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Functions.php \PHPExcel_Calculation_Functions::N()

* N * * Returns a value converted to a number * *

Parameters

value The value you want converted: * @return number N converts values listed in the following table * If value is or refers to N returns * A number That number * A date The serial number of that date * TRUE 1 * FALSE 0 * An error value The error value * Anything else 0

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Functions.php, line 518

Class

PHPExcel_Calculation_Functions
PHPExcel_Calculation_Functions

Code

public static function N($value = NULL) {
  while (is_array($value)) {
    $value = array_shift($value);
  }
  switch (gettype($value)) {
    case 'double':
    case 'float':
    case 'integer':
      return $value;
      break;
    case 'boolean':
      return (int) $value;
      break;
    case 'string':

      //	Errors
      if (strlen($value) > 0 && $value[0] == '#') {
        return $value;
      }
      break;
  }
  return 0;
}