code: public static function PERCENTILE(...$args)
      {
          $aArgs = Functions::flattenArray($args);
  
          // Calculate
          $entry = array_pop($aArgs);
  
          if ((is_numeric($entry)) && (!is_string($entry))) {
              if (($entry < 0) || ($entry > 1)) {
                  return Functions::NAN();
              }
              $mArgs = [];
              foreach ($aArgs as $arg) {
                  // Is it a numeric value?
                  if ((is_numeric($arg)) && (!is_string($arg))) {
                      $mArgs[] = $arg;
                  }
              }
              $mValueCount = count($mArgs);
              if ($mValueCount > 0) {
                  sort($mArgs);
                  $count = self::COUNT($mArgs);
                  $index = $entry * ($count - 1);
                  $iBase = floor($index);
                  if ($index == $iBase) {
                      return $mArgs[$index];
                  }
                  $iNext = $iBase + 1;
                  $iProportion = $index - $iBase;
  
                  return $mArgs[$iBase] + (($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion);
              }
          }
  
          return Functions::VALUE();
      }
docs: PERCENTILE.
  
  Returns the nth percentile of values in a range..
  
  Excel Function:
  PERCENTILE(value1[,value2[, ...]],entry)
  
  @category Statistical Functions
  
  @param mixed $args Data values
  @param float $entry Percentile value in the range 0..1, inclusive.
  
  @return float