code: public static function SYD($cost, $salvage, $life, $period)
      {
          $cost = Functions::flattenSingleValue($cost);
          $salvage = Functions::flattenSingleValue($salvage);
          $life = Functions::flattenSingleValue($life);
          $period = Functions::flattenSingleValue($period);
  
          // Calculate
          if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period))) {
              if (($life < 1) || ($period > $life)) {
                  return Functions::NAN();
              }
  
              return (($cost - $salvage) * ($life - $period + 1) * 2) / ($life * ($life + 1));
          }
  
          return Functions::VALUE();
      }
docs: SYD.
  
  Returns the sum-of-years' digits depreciation of an asset for a specified period.
  
  @param mixed $cost Initial cost of the asset
  @param mixed $salvage Value at the end of the depreciation
  @param mixed $life Number of periods over which the asset is depreciated
  @param mixed $period Period
  
  @return float