Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 311 and 401] [Versions 400 and 401]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
   4  
   5  class Xlfn
   6  {
   7      const XLFNREGEXP = '/(?<!_xlfn[.])\\b('
   8              // functions added with Excel 2010
   9          . 'beta[.]dist'
  10          . '|beta[.]inv'
  11          . '|binom[.]dist'
  12          . '|binom[.]inv'
  13          . '|ceiling[.]precise'
  14          . '|chisq[.]dist'
  15          . '|chisq[.]dist[.]rt'
  16          . '|chisq[.]inv'
  17          . '|chisq[.]inv[.]rt'
  18          . '|chisq[.]test'
  19          . '|confidence[.]norm'
  20          . '|confidence[.]t'
  21          . '|covariance[.]p'
  22          . '|covariance[.]s'
  23          . '|erf[.]precise'
  24          . '|erfc[.]precise'
  25          . '|expon[.]dist'
  26          . '|f[.]dist'
  27          . '|f[.]dist[.]rt'
  28          . '|f[.]inv'
  29          . '|f[.]inv[.]rt'
  30          . '|f[.]test'
  31          . '|floor[.]precise'
  32          . '|gamma[.]dist'
  33          . '|gamma[.]inv'
  34          . '|gammaln[.]precise'
  35          . '|lognorm[.]dist'
  36          . '|lognorm[.]inv'
  37          . '|mode[.]mult'
  38          . '|mode[.]sngl'
  39          . '|negbinom[.]dist'
  40          . '|networkdays[.]intl'
  41          . '|norm[.]dist'
  42          . '|norm[.]inv'
  43          . '|norm[.]s[.]dist'
  44          . '|norm[.]s[.]inv'
  45          . '|percentile[.]exc'
  46          . '|percentile[.]inc'
  47          . '|percentrank[.]exc'
  48          . '|percentrank[.]inc'
  49          . '|poisson[.]dist'
  50          . '|quartile[.]exc'
  51          . '|quartile[.]inc'
  52          . '|rank[.]avg'
  53          . '|rank[.]eq'
  54          . '|stdev[.]p'
  55          . '|stdev[.]s'
  56          . '|t[.]dist'
  57          . '|t[.]dist[.]2t'
  58          . '|t[.]dist[.]rt'
  59          . '|t[.]inv'
  60          . '|t[.]inv[.]2t'
  61          . '|t[.]test'
  62          . '|var[.]p'
  63          . '|var[.]s'
  64          . '|weibull[.]dist'
  65          . '|z[.]test'
  66          // functions added with Excel 2013
  67          . '|acot'
  68          . '|acoth'
  69          . '|arabic'
  70          . '|averageifs'
  71          . '|binom[.]dist[.]range'
  72          . '|bitand'
  73          . '|bitlshift'
  74          . '|bitor'
  75          . '|bitrshift'
  76          . '|bitxor'
  77          . '|ceiling[.]math'
  78          . '|combina'
  79          . '|cot'
  80          . '|coth'
  81          . '|csc'
  82          . '|csch'
  83          . '|days'
  84          . '|dbcs'
  85          . '|decimal'
  86          . '|encodeurl'
  87          . '|filterxml'
  88          . '|floor[.]math'
  89          . '|formulatext'
  90          . '|gamma'
  91          . '|gauss'
  92          . '|ifna'
  93          . '|imcosh'
  94          . '|imcot'
  95          . '|imcsc'
  96          . '|imcsch'
  97          . '|imsec'
  98          . '|imsech'
  99          . '|imsinh'
 100          . '|imtan'
 101          . '|isformula'
 102          . '|iso[.]ceiling'
 103          . '|isoweeknum'
 104          . '|munit'
 105          . '|numbervalue'
 106          . '|pduration'
 107          . '|permutationa'
 108          . '|phi'
 109          . '|rri'
 110          . '|sec'
 111          . '|sech'
 112          . '|sheet'
 113          . '|sheets'
 114          . '|skew[.]p'
 115          . '|unichar'
 116          . '|unicode'
 117          . '|webservice'
 118          . '|xor'
 119          // functions added with Excel 2016
 120          . '|forecast[.]et2'
 121          . '|forecast[.]ets[.]confint'
 122          . '|forecast[.]ets[.]seasonality'
 123          . '|forecast[.]ets[.]stat'
 124          . '|forecast[.]linear'
 125          . '|switch'
 126          // functions added with Excel 2019
 127          . '|concat'
 128          . '|countifs'
 129          . '|ifs'
 130          . '|maxifs'
 131          . '|minifs'
 132          . '|sumifs'
 133          . '|textjoin'
 134          // functions added with Excel 365
 135          . '|filter'
 136          . '|randarray'
 137          . '|sequence'
 138          . '|sort'
 139          . '|sortby'
 140          . '|unique'
 141          . '|xlookup'
 142          . '|xmatch'
 143          . '|arraytotext'
 144          . '|call'
 145          . '|let'
 146          . '|register[.]id'
 147          . '|textafter'
 148          . '|textbefore'
 149          . '|textsplit'
 150          . '|valuetotext'
 151          . ')(?=\\s*[(])/i';
 152  
 153      /**
 154       * Prefix function name in string with _xlfn. where required.
 155       */
 156      public static function addXlfn(string $funcstring): string
 157      {
 158          return (string) preg_replace(self::XLFNREGEXP, '_xlfn.$1', $funcstring);
 159      }
 160  
 161      /**
 162       * Prefix function name in string with _xlfn. where required.
 163       * Leading character, expected to be equals sign, is stripped.
 164       */
 165      public static function addXlfnStripEquals(string $funcstring): string
 166      {
 167          return self::addXlfn(substr($funcstring, 1));
 168      }
 169  }