code: public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis = 0)
      {
          $settlement = Functions::flattenSingleValue($settlement);
          $maturity = Functions::flattenSingleValue($maturity);
          $investment = (float) Functions::flattenSingleValue($investment);
          $discount = (float) Functions::flattenSingleValue($discount);
          $basis = (int) Functions::flattenSingleValue($basis);
  
          //    Validate
          if ((is_numeric($investment)) && (is_numeric($discount)) && (is_numeric($basis))) {
              if (($investment <= 0) || ($discount <= 0)) {
                  return Functions::NAN();
              }
              $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis);
              if (!is_numeric($daysBetweenSettlementAndMaturity)) {
                  //    return date error
                  return $daysBetweenSettlementAndMaturity;
              }
  
              return $investment / (1 - ($discount * $daysBetweenSettlementAndMaturity));
          }
  
          return Functions::VALUE();
      }
docs: RECEIVED.
  
  Returns the price per $100 face value of a discounted security.
  
  @param mixed $settlement The security's settlement date.
  The security settlement date is the date after the issue date when the security is traded to the buyer.
  @param mixed $maturity The security's maturity date.
  The maturity date is the date when the security expires.
  @param int $investment The amount invested in the security
  @param int $discount The security's discount rate
  @param int $basis The type of day count to use.
  0 or omitted    US (NASD) 30/360
  1                Actual/actual
  2                Actual/360
  3                Actual/365
  4                European 30/360
  
  @return float