Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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