code: public static function NPV(...$args)
      {
          // Return value
          $returnValue = 0;
  
          // Loop through arguments
          $aArgs = Functions::flattenArray($args);
  
          // Calculate
          $rate = array_shift($aArgs);
          $countArgs = count($aArgs);
          for ($i = 1; $i <= $countArgs; ++$i) {
              // Is it a numeric value?
              if (is_numeric($aArgs[$i - 1])) {
                  $returnValue += $aArgs[$i - 1] / pow(1 + $rate, $i);
              }
          }
  
          // Return
          return $returnValue;
      }
docs: NPV.
  
  Returns the Net Present Value of a cash flow series given a discount rate.
  
  @return float