PHPExcel_Calculation
[ class tree: PHPExcel_Calculation ] [ index: PHPExcel_Calculation ] [ all elements ]

Source for file Calculation.php

Documentation is available at Calculation.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2010 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel_Calculation
  23.  * @copyright  Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.3c, 2010-06-01
  26.  */
  27.  
  28.  
  29. /** PHPExcel root directory */
  30. if (!defined('PHPEXCEL_ROOT')) {
  31.     /**
  32.      * @ignore
  33.      */
  34.     define('PHPEXCEL_ROOT'dirname(__FILE__'/../');
  35.     require(PHPEXCEL_ROOT 'PHPExcel/Autoloader.php');
  36.     // check mbstring.func_overload
  37.     if (ini_get('mbstring.func_overload'2{
  38.         throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
  39.     }
  40. }
  41.  
  42.  
  43. /** Matrix */
  44. require_once PHPEXCEL_ROOT 'PHPExcel/Shared/JAMA/Matrix.php';
  45.  
  46.  
  47. /**
  48.  * PHPExcel_Calculation (Singleton)
  49.  *
  50.  * @category   PHPExcel
  51.  * @package    PHPExcel_Calculation
  52.  * @copyright  Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  53.  */
  54.  
  55.     /**    Constants                */
  56.             const CALCULATION_REGEXP_NUMBER        '[-+]?\d*\.?\d+(e[-+]?\d+)?';
  57.     //    String operand
  58.     const CALCULATION_REGEXP_STRING        '"(?:[^"]|"")*"';
  59.     //    Opening bracket
  60.     const CALCULATION_REGEXP_OPENBRACE    '\(';
  61.     //    Function
  62.     const CALCULATION_REGEXP_FUNCTION    '@?([A-Z][A-Z0-9\.]*)[\s]*\(';
  63.     //    Cell reference (cell or range of cells, with or without a sheet reference)
  64.     const CALCULATION_REGEXP_CELLREF    '(((\w*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d+)';
  65.     //    Named Range of cells
  66.     const CALCULATION_REGEXP_NAMEDRANGE    '(((\w*)|(\'.*\')|(\".*\"))!)?([_A-Z][_A-Z0-9]*)';
  67.     //    Error
  68.     const CALCULATION_REGEXP_ERROR        '\#[A-Z][A-Z0_\/]*[!\?]?';
  69.  
  70.  
  71.     /**    constants */
  72.     const RETURN_ARRAY_AS_ERROR 'error';
  73.     const RETURN_ARRAY_AS_VALUE 'value';
  74.     const RETURN_ARRAY_AS_ARRAY 'array';
  75.  
  76.     private static $returnArrayAsType    self::RETURN_ARRAY_AS_VALUE;
  77.  
  78.  
  79.     /**
  80.      *    Instance of this class
  81.      *
  82.      *    @access    private
  83.      *    @var PHPExcel_Calculation 
  84.      */
  85.     private static $_instance;
  86.  
  87.  
  88.     /**
  89.      *    Calculation cache
  90.      *
  91.      *    @access    private
  92.      *    @var array 
  93.      */
  94.     private static $_calculationCache array ();
  95.  
  96.  
  97.     /**
  98.      *    Calculation cache enabled
  99.      *
  100.      *    @access    private
  101.      *    @var boolean 
  102.      */
  103.     private static $_calculationCacheEnabled true;
  104.  
  105.  
  106.     /**
  107.      *    Calculation cache expiration time
  108.      *
  109.      *    @access    private
  110.      *    @var float 
  111.      */
  112.     private static $_calculationCacheExpirationTime 15;
  113.  
  114.  
  115.     /**
  116.      *    List of operators that can be used within formulae
  117.      *
  118.      *    @access    private
  119.      *    @var array 
  120.      */
  121.     private static $_operators            array('+''-''*''/''^''&''%''~''>''<''=''>=''<=''<>''|'':');
  122.  
  123.  
  124.     /**
  125.      *    List of binary operators (those that expect two operands)
  126.      *
  127.      *    @access    private
  128.      *    @var array 
  129.      */
  130.     private static $_binaryOperators    array('+''-''*''/''^''&''>''<''=''>=''<=''<>''|'':');
  131.  
  132.     /**
  133.      *    Flag to determine how formula errors should be handled
  134.      *        If true, then a user error will be triggered
  135.      *        If false, then an exception will be thrown
  136.      *
  137.      *    @access    public
  138.      *    @var boolean 
  139.      *
  140.      */
  141.     public $suppressFormulaErrors = false;
  142.  
  143.     /**
  144.      *    Error message for any error that was raised/thrown by the calculation engine
  145.      *
  146.      *    @access    public
  147.      *    @var string 
  148.      *
  149.      */
  150.     public $formulaError = null;
  151.  
  152.     /**
  153.      *    Flag to determine whether a debug log should be generated by the calculation engine
  154.      *        If true, then a debug log will be generated
  155.      *        If false, then a debug log will not be generated
  156.      *
  157.      *    @access    public
  158.      *    @var boolean 
  159.      *
  160.      */
  161.     public $writeDebugLog = false;
  162.  
  163.     /**
  164.      *    An array of the nested cell references accessed by the calculation engine, used for the debug log
  165.      *
  166.      *    @access    private
  167.      *    @var array of string
  168.      *
  169.      */
  170.     private $debugLogStack array();
  171.  
  172.     /**
  173.      *    The debug log generated by the calculation engine
  174.      *
  175.      *    @access    public
  176.      *    @var array of string
  177.      *
  178.      */
  179.     public $debugLog = array();
  180.     private $_cyclicFormulaCount 0;
  181.     private $_cyclicFormulaCell '';
  182.     public $cyclicFormulaCount = 0;
  183.  
  184.  
  185.     private static $_localeLanguage 'en_us';                    //    US English    (default locale)
  186.     private static $_validLocaleLanguages array(    'en'        //    English        (default language)
  187.                                                  );
  188.     private static $_localeArgumentSeparator ',';
  189.     private static $_localeFunctions array();
  190.     private static $_localeBoolean array(    'TRUE'    => 'TRUE',
  191.                                             'FALSE'    => 'FALSE',
  192.                                             'NULL'    => 'NULL'
  193.                                           );
  194.  
  195.  
  196.     //    Constant conversion from text name/value to actual (datatyped) value
  197.     private static $_ExcelConstants array('TRUE'    => True,
  198.                                             'FALSE'    => False,
  199.                                             'NULL'    => Null
  200.                                            );
  201.  
  202.     //    PHPExcel functions
  203.     private static $_PHPExcelFunctions array(    // PHPExcel functions
  204.                 'ABS'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  205.                                                  'functionCall'        =>    'abs',
  206.                                                  'argumentCount'    =>    '1'
  207.                                                 ),
  208.                 'ACCRINT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  209.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ACCRINT',
  210.                                                  'argumentCount'    =>    '4-7'
  211.                                                 ),
  212.                 'ACCRINTM'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  213.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ACCRINTM',
  214.                                                  'argumentCount'    =>    '3-5'
  215.                                                 ),
  216.                 'ACOS'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  217.                                                  'functionCall'        =>    'acos',
  218.                                                  'argumentCount'    =>    '1'
  219.                                                 ),
  220.                 'ACOSH'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  221.                                                  'functionCall'        =>    'acosh',
  222.                                                  'argumentCount'    =>    '1'
  223.                                                 ),
  224.                 'ADDRESS'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  225.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CELL_ADDRESS',
  226.                                                  'argumentCount'    =>    '2-5'
  227.                                                 ),
  228.                 'AMORDEGRC'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  229.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::AMORDEGRC',
  230.                                                  'argumentCount'    =>    '6,7'
  231.                                                 ),
  232.                 'AMORLINC'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  233.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::AMORLINC',
  234.                                                  'argumentCount'    =>    '6,7'
  235.                                                 ),
  236.                 'AND'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
  237.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LOGICAL_AND',
  238.                                                  'argumentCount'    =>    '1+'
  239.                                                 ),
  240.                 'AREAS'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  241.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  242.                                                  'argumentCount'    =>    '1'
  243.                                                 ),
  244.                 'ASC'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  245.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  246.                                                  'argumentCount'    =>    '1'
  247.                                                 ),
  248.                 'ASIN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  249.                                                  'functionCall'        =>    'asin',
  250.                                                  'argumentCount'    =>    '1'
  251.                                                 ),
  252.                 'ASINH'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  253.                                                  'functionCall'        =>    'asinh',
  254.                                                  'argumentCount'    =>    '1'
  255.                                                 ),
  256.                 'ATAN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  257.                                                  'functionCall'        =>    'atan',
  258.                                                  'argumentCount'    =>    '1'
  259.                                                 ),
  260.                 'ATAN2'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  261.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::REVERSE_ATAN2',
  262.                                                  'argumentCount'    =>    '2'
  263.                                                 ),
  264.                 'ATANH'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  265.                                                  'functionCall'        =>    'atanh',
  266.                                                  'argumentCount'    =>    '1'
  267.                                                 ),
  268.                 'AVEDEV'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  269.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::AVEDEV',
  270.                                                  'argumentCount'    =>    '1+'
  271.                                                 ),
  272.                 'AVERAGE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  273.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::AVERAGE',
  274.                                                  'argumentCount'    =>    '1+'
  275.                                                 ),
  276.                 'AVERAGEA'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  277.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::AVERAGEA',
  278.                                                  'argumentCount'    =>    '1+'
  279.                                                 ),
  280.                 'AVERAGEIF'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  281.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  282.                                                  'argumentCount'    =>    '2,3'
  283.                                                 ),
  284.                 'AVERAGEIFS'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  285.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  286.                                                  'argumentCount'    =>    '3+'
  287.                                                 ),
  288.                 'BAHTTEXT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  289.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  290.                                                  'argumentCount'    =>    '1'
  291.                                                 ),
  292.                 'BESSELI'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  293.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::BESSELI',
  294.                                                  'argumentCount'    =>    '2'
  295.                                                 ),
  296.                 'BESSELJ'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  297.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::BESSELJ',
  298.                                                  'argumentCount'    =>    '2'
  299.                                                 ),
  300.                 'BESSELK'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  301.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::BESSELK',
  302.                                                  'argumentCount'    =>    '2'
  303.                                                 ),
  304.                 'BESSELY'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  305.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::BESSELY',
  306.                                                  'argumentCount'    =>    '2'
  307.                                                 ),
  308.                 'BETADIST'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  309.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::BETADIST',
  310.                                                  'argumentCount'    =>    '3-5'
  311.                                                 ),
  312.                 'BETAINV'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  313.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::BETAINV',
  314.                                                  'argumentCount'    =>    '3-5'
  315.                                                 ),
  316.                 'BIN2DEC'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  317.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::BINTODEC',
  318.                                                  'argumentCount'    =>    '1'
  319.                                                 ),
  320.                 'BIN2HEX'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  321.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::BINTOHEX',
  322.                                                  'argumentCount'    =>    '1,2'
  323.                                                 ),
  324.                 'BIN2OCT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  325.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::BINTOOCT',
  326.                                                  'argumentCount'    =>    '1,2'
  327.                                                 ),
  328.                 'BINOMDIST'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  329.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::BINOMDIST',
  330.                                                  'argumentCount'    =>    '4'
  331.                                                 ),
  332.                 'CEILING'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  333.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CEILING',
  334.                                                  'argumentCount'    =>    '2'
  335.                                                 ),
  336.                 'CELL'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  337.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  338.                                                  'argumentCount'    =>    '1,2'
  339.                                                 ),
  340.                 'CHAR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  341.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CHARACTER',
  342.                                                  'argumentCount'    =>    '1'
  343.                                                 ),
  344.                 'CHIDIST'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  345.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CHIDIST',
  346.                                                  'argumentCount'    =>    '2'
  347.                                                 ),
  348.                 'CHIINV'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  349.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CHIINV',
  350.                                                  'argumentCount'    =>    '2'
  351.                                                 ),
  352.                 'CHITEST'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  353.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  354.                                                  'argumentCount'    =>    '2'
  355.                                                 ),
  356.                 'CHOOSE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  357.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CHOOSE',
  358.                                                  'argumentCount'    =>    '2+'
  359.                                                 ),
  360.                 'CLEAN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  361.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TRIMNONPRINTABLE',
  362.                                                  'argumentCount'    =>    '1'
  363.                                                 ),
  364.                 'CODE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  365.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ASCIICODE',
  366.                                                  'argumentCount'    =>    '1'
  367.                                                 ),
  368.                 'COLUMN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  369.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COLUMN',
  370.                                                  'argumentCount'    =>    '-1',
  371.                                                  'passByReference'    =>    array(true)
  372.                                                 ),
  373.                 'COLUMNS'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  374.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COLUMNS',
  375.                                                  'argumentCount'    =>    '1'
  376.                                                 ),
  377.                 'COMBIN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  378.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COMBIN',
  379.                                                  'argumentCount'    =>    '2'
  380.                                                 ),
  381.                 'COMPLEX'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  382.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COMPLEX',
  383.                                                  'argumentCount'    =>    '2,3'
  384.                                                 ),
  385.                 'CONCATENATE'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  386.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CONCATENATE',
  387.                                                  'argumentCount'    =>    '1+'
  388.                                                 ),
  389.                 'CONFIDENCE'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  390.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CONFIDENCE',
  391.                                                  'argumentCount'    =>    '3'
  392.                                                 ),
  393.                 'CONVERT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  394.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CONVERTUOM',
  395.                                                  'argumentCount'    =>    '3'
  396.                                                 ),
  397.                 'CORREL'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  398.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CORREL',
  399.                                                  'argumentCount'    =>    '2'
  400.                                                 ),
  401.                 'COS'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  402.                                                  'functionCall'        =>    'cos',
  403.                                                  'argumentCount'    =>    '1'
  404.                                                 ),
  405.                 'COSH'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  406.                                                  'functionCall'        =>    'cosh',
  407.                                                  'argumentCount'    =>    '1'
  408.                                                 ),
  409.                 'COUNT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  410.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COUNT',
  411.                                                  'argumentCount'    =>    '1+'
  412.                                                 ),
  413.                 'COUNTA'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  414.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COUNTA',
  415.                                                  'argumentCount'    =>    '1+'
  416.                                                 ),
  417.                 'COUNTBLANK'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  418.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COUNTBLANK',
  419.                                                  'argumentCount'    =>    '1'
  420.                                                 ),
  421.                 'COUNTIF'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  422.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COUNTIF',
  423.                                                  'argumentCount'    =>    '2'
  424.                                                 ),
  425.                 'COUNTIFS'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  426.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  427.                                                  'argumentCount'    =>    '2'
  428.                                                 ),
  429.                 'COUPDAYBS'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  430.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COUPDAYBS',
  431.                                                  'argumentCount'    =>    '3,4'
  432.                                                 ),
  433.                 'COUPDAYS'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  434.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COUPDAYS',
  435.                                                  'argumentCount'    =>    '3,4'
  436.                                                 ),
  437.                 'COUPDAYSNC'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  438.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COUPDAYSNC',
  439.                                                  'argumentCount'    =>    '3,4'
  440.                                                 ),
  441.                 'COUPNCD'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  442.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COUPNCD',
  443.                                                  'argumentCount'    =>    '3,4'
  444.                                                 ),
  445.                 'COUPNUM'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  446.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COUPNUM',
  447.                                                  'argumentCount'    =>    '3,4'
  448.                                                 ),
  449.                 'COUPPCD'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  450.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COUPPCD',
  451.                                                  'argumentCount'    =>    '3,4'
  452.                                                 ),
  453.                 'COVAR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  454.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::COVAR',
  455.                                                  'argumentCount'    =>    '2'
  456.                                                 ),
  457.                 'CRITBINOM'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  458.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CRITBINOM',
  459.                                                  'argumentCount'    =>    '3'
  460.                                                 ),
  461.                 'CUBEKPIMEMBER'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_CUBE,
  462.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  463.                                                  'argumentCount'    =>    '?'
  464.                                                 ),
  465.                 'CUBEMEMBER'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_CUBE,
  466.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  467.                                                  'argumentCount'    =>    '?'
  468.                                                 ),
  469.                 'CUBEMEMBERPROPERTY'    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_CUBE,
  470.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  471.                                                  'argumentCount'    =>    '?'
  472.                                                 ),
  473.                 'CUBERANKEDMEMBER'        => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_CUBE,
  474.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  475.                                                  'argumentCount'    =>    '?'
  476.                                                 ),
  477.                 'CUBESET'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_CUBE,
  478.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  479.                                                  'argumentCount'    =>    '?'
  480.                                                 ),
  481.                 'CUBESETCOUNT'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_CUBE,
  482.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  483.                                                  'argumentCount'    =>    '?'
  484.                                                 ),
  485.                 'CUBEVALUE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_CUBE,
  486.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  487.                                                  'argumentCount'    =>    '?'
  488.                                                 ),
  489.                 'CUMIPMT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  490.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CUMIPMT',
  491.                                                  'argumentCount'    =>    '6'
  492.                                                 ),
  493.                 'CUMPRINC'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  494.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CUMPRINC',
  495.                                                  'argumentCount'    =>    '6'
  496.                                                 ),
  497.                 'DATE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  498.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DATE',
  499.                                                  'argumentCount'    =>    '3'
  500.                                                 ),
  501.                 'DATEDIF'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  502.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DATEDIF',
  503.                                                  'argumentCount'    =>    '2,3'
  504.                                                 ),
  505.                 'DATEVALUE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  506.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DATEVALUE',
  507.                                                  'argumentCount'    =>    '1'
  508.                                                 ),
  509.                 'DAVERAGE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  510.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  511.                                                  'argumentCount'    =>    '3'
  512.                                                 ),
  513.                 'DAY'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  514.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DAYOFMONTH',
  515.                                                  'argumentCount'    =>    '1'
  516.                                                 ),
  517.                 'DAYS360'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  518.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DAYS360',
  519.                                                  'argumentCount'    =>    '2,3'
  520.                                                 ),
  521.                 'DB'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  522.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DB',
  523.                                                  'argumentCount'    =>    '4,5'
  524.                                                 ),
  525.                 'DCOUNT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  526.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  527.                                                  'argumentCount'    =>    '3'
  528.                                                 ),
  529.                 'DCOUNTA'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  530.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  531.                                                  'argumentCount'    =>    '3'
  532.                                                 ),
  533.                 'DDB'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  534.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DDB',
  535.                                                  'argumentCount'    =>    '4,5'
  536.                                                 ),
  537.                 'DEC2BIN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  538.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DECTOBIN',
  539.                                                  'argumentCount'    =>    '1,2'
  540.                                                 ),
  541.                 'DEC2HEX'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  542.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DECTOHEX',
  543.                                                  'argumentCount'    =>    '1,2'
  544.                                                 ),
  545.                 'DEC2OCT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  546.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DECTOOCT',
  547.                                                  'argumentCount'    =>    '1,2'
  548.                                                 ),
  549.                 'DEGREES'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  550.                                                  'functionCall'        =>    'rad2deg',
  551.                                                  'argumentCount'    =>    '1'
  552.                                                 ),
  553.                 'DELTA'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  554.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DELTA',
  555.                                                  'argumentCount'    =>    '1,2'
  556.                                                 ),
  557.                 'DEVSQ'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  558.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DEVSQ',
  559.                                                  'argumentCount'    =>    '1+'
  560.                                                 ),
  561.                 'DGET'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  562.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  563.                                                  'argumentCount'    =>    '3'
  564.                                                 ),
  565.                 'DISC'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  566.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DISC',
  567.                                                  'argumentCount'    =>    '4,5'
  568.                                                 ),
  569.                 'DMAX'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  570.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  571.                                                  'argumentCount'    =>    '3'
  572.                                                 ),
  573.                 'DMIN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  574.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  575.                                                  'argumentCount'    =>    '3'
  576.                                                 ),
  577.                 'DOLLAR'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  578.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DOLLAR',
  579.                                                  'argumentCount'    =>    '1,2'
  580.                                                 ),
  581.                 'DOLLARDE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  582.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DOLLARDE',
  583.                                                  'argumentCount'    =>    '2'
  584.                                                 ),
  585.                 'DOLLARFR'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  586.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DOLLARFR',
  587.                                                  'argumentCount'    =>    '2'
  588.                                                 ),
  589.                 'DPRODUCT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  590.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  591.                                                  'argumentCount'    =>    '3'
  592.                                                 ),
  593.                 'DSTDEV'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  594.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  595.                                                  'argumentCount'    =>    '3'
  596.                                                 ),
  597.                 'DSTDEVP'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  598.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  599.                                                  'argumentCount'    =>    '3'
  600.                                                 ),
  601.                 'DSUM'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  602.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  603.                                                  'argumentCount'    =>    '3'
  604.                                                 ),
  605.                 'DURATION'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  606.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  607.                                                  'argumentCount'    =>    '5,6'
  608.                                                 ),
  609.                 'DVAR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  610.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  611.                                                  'argumentCount'    =>    '3'
  612.                                                 ),
  613.                 'DVARP'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATABASE,
  614.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  615.                                                  'argumentCount'    =>    '3'
  616.                                                 ),
  617.                 'EDATE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  618.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::EDATE',
  619.                                                  'argumentCount'    =>    '2'
  620.                                                 ),
  621.                 'EFFECT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  622.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::EFFECT',
  623.                                                  'argumentCount'    =>    '2'
  624.                                                 ),
  625.                 'EOMONTH'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  626.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::EOMONTH',
  627.                                                  'argumentCount'    =>    '2'
  628.                                                 ),
  629.                 'ERF'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  630.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ERF',
  631.                                                  'argumentCount'    =>    '1,2'
  632.                                                 ),
  633.                 'ERFC'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  634.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ERFC',
  635.                                                  'argumentCount'    =>    '1'
  636.                                                 ),
  637.                 'ERROR.TYPE'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  638.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ERROR_TYPE',
  639.                                                  'argumentCount'    =>    '1'
  640.                                                 ),
  641.                 'EVEN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  642.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::EVEN',
  643.                                                  'argumentCount'    =>    '1'
  644.                                                 ),
  645.                 'EXACT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  646.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  647.                                                  'argumentCount'    =>    '2'
  648.                                                 ),
  649.                 'EXP'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  650.                                                  'functionCall'        =>    'exp',
  651.                                                  'argumentCount'    =>    '1'
  652.                                                 ),
  653.                 'EXPONDIST'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  654.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::EXPONDIST',
  655.                                                  'argumentCount'    =>    '3'
  656.                                                 ),
  657.                 'FACT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  658.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::FACT',
  659.                                                  'argumentCount'    =>    '1'
  660.                                                 ),
  661.                 'FACTDOUBLE'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  662.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::FACTDOUBLE',
  663.                                                  'argumentCount'    =>    '1'
  664.                                                 ),
  665.                 'FALSE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
  666.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LOGICAL_FALSE',
  667.                                                  'argumentCount'    =>    '0'
  668.                                                 ),
  669.                 'FDIST'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  670.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  671.                                                  'argumentCount'    =>    '3'
  672.                                                 ),
  673.                 'FIND'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  674.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SEARCHSENSITIVE',
  675.                                                  'argumentCount'    =>    '2,3'
  676.                                                 ),
  677.                 'FINDB'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  678.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SEARCHSENSITIVE',
  679.                                                  'argumentCount'    =>    '2,3'
  680.                                                 ),
  681.                 'FINV'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  682.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  683.                                                  'argumentCount'    =>    '3'
  684.                                                 ),
  685.                 'FISHER'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  686.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::FISHER',
  687.                                                  'argumentCount'    =>    '1'
  688.                                                 ),
  689.                 'FISHERINV'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  690.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::FISHERINV',
  691.                                                  'argumentCount'    =>    '1'
  692.                                                 ),
  693.                 'FIXED'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  694.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::FIXEDFORMAT',
  695.                                                  'argumentCount'    =>    '1-3'
  696.                                                 ),
  697.                 'FLOOR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  698.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::FLOOR',
  699.                                                  'argumentCount'    =>    '2'
  700.                                                 ),
  701.                 'FORECAST'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  702.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::FORECAST',
  703.                                                  'argumentCount'    =>    '3'
  704.                                                 ),
  705.                 'FREQUENCY'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  706.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  707.                                                  'argumentCount'    =>    '2'
  708.                                                 ),
  709.                 'FTEST'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  710.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  711.                                                  'argumentCount'    =>    '2'
  712.                                                 ),
  713.                 'FV'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  714.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::FV',
  715.                                                  'argumentCount'    =>    '3-5'
  716.                                                 ),
  717.                 'FVSCHEDULE'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  718.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::FVSCHEDULE',
  719.                                                  'argumentCount'    =>    '2'
  720.                                                 ),
  721.                 'GAMMADIST'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  722.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::GAMMADIST',
  723.                                                  'argumentCount'    =>    '4'
  724.                                                 ),
  725.                 'GAMMAINV'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  726.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::GAMMAINV',
  727.                                                  'argumentCount'    =>    '3'
  728.                                                 ),
  729.                 'GAMMALN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  730.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::GAMMALN',
  731.                                                  'argumentCount'    =>    '1'
  732.                                                 ),
  733.                 'GCD'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  734.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::GCD',
  735.                                                  'argumentCount'    =>    '1+'
  736.                                                 ),
  737.                 'GEOMEAN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  738.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::GEOMEAN',
  739.                                                  'argumentCount'    =>    '1+'
  740.                                                 ),
  741.                 'GESTEP'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  742.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::GESTEP',
  743.                                                  'argumentCount'    =>    '1,2'
  744.                                                 ),
  745.                 'GETPIVOTDATA'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  746.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  747.                                                  'argumentCount'    =>    '2+'
  748.                                                 ),
  749.                 'GROWTH'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  750.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::GROWTH',
  751.                                                  'argumentCount'    =>    '1-4'
  752.                                                 ),
  753.                 'HARMEAN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  754.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::HARMEAN',
  755.                                                  'argumentCount'    =>    '1+'
  756.                                                 ),
  757.                 'HEX2BIN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  758.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::HEXTOBIN',
  759.                                                  'argumentCount'    =>    '1,2'
  760.                                                 ),
  761.                 'HEX2DEC'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  762.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::HEXTODEC',
  763.                                                  'argumentCount'    =>    '1'
  764.                                                 ),
  765.                 'HEX2OCT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  766.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::HEXTOOCT',
  767.                                                  'argumentCount'    =>    '1,2'
  768.                                                 ),
  769.                 'HLOOKUP'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  770.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  771.                                                  'argumentCount'    =>    '3,4'
  772.                                                 ),
  773.                 'HOUR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  774.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::HOUROFDAY',
  775.                                                  'argumentCount'    =>    '1'
  776.                                                 ),
  777.                 'HYPERLINK'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  778.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::HYPERLINK',
  779.                                                  'argumentCount'    =>    '1,2',
  780.                                                  'passCellReference'=>    true
  781.                                                 ),
  782.                 'HYPGEOMDIST'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  783.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::HYPGEOMDIST',
  784.                                                  'argumentCount'    =>    '4'
  785.                                                 ),
  786.                 'IF'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
  787.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::STATEMENT_IF',
  788.                                                  'argumentCount'    =>    '1-3'
  789.                                                 ),
  790.                 'IFERROR'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
  791.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::STATEMENT_IFERROR',
  792.                                                  'argumentCount'    =>    '2'
  793.                                                 ),
  794.                 'IMABS'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  795.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMABS',
  796.                                                  'argumentCount'    =>    '1'
  797.                                                 ),
  798.                 'IMAGINARY'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  799.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMAGINARY',
  800.                                                  'argumentCount'    =>    '1'
  801.                                                 ),
  802.                 'IMARGUMENT'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  803.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMARGUMENT',
  804.                                                  'argumentCount'    =>    '1'
  805.                                                 ),
  806.                 'IMCONJUGATE'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  807.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMCONJUGATE',
  808.                                                  'argumentCount'    =>    '1'
  809.                                                 ),
  810.                 'IMCOS'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  811.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMCOS',
  812.                                                  'argumentCount'    =>    '1'
  813.                                                 ),
  814.                 'IMDIV'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  815.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMDIV',
  816.                                                  'argumentCount'    =>    '2'
  817.                                                 ),
  818.                 'IMEXP'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  819.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMEXP',
  820.                                                  'argumentCount'    =>    '1'
  821.                                                 ),
  822.                 'IMLN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  823.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMLN',
  824.                                                  'argumentCount'    =>    '1'
  825.                                                 ),
  826.                 'IMLOG10'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  827.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMLOG10',
  828.                                                  'argumentCount'    =>    '1'
  829.                                                 ),
  830.                 'IMLOG2'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  831.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMLOG2',
  832.                                                  'argumentCount'    =>    '1'
  833.                                                 ),
  834.                 'IMPOWER'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  835.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMPOWER',
  836.                                                  'argumentCount'    =>    '2'
  837.                                                 ),
  838.                 'IMPRODUCT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  839.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMPRODUCT',
  840.                                                  'argumentCount'    =>    '1+'
  841.                                                 ),
  842.                 'IMREAL'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  843.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMREAL',
  844.                                                  'argumentCount'    =>    '1'
  845.                                                 ),
  846.                 'IMSIN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  847.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMSIN',
  848.                                                  'argumentCount'    =>    '1'
  849.                                                 ),
  850.                 'IMSQRT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  851.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMSQRT',
  852.                                                  'argumentCount'    =>    '1'
  853.                                                 ),
  854.                 'IMSUB'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  855.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMSUB',
  856.                                                  'argumentCount'    =>    '2'
  857.                                                 ),
  858.                 'IMSUM'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  859.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IMSUM',
  860.                                                  'argumentCount'    =>    '1+'
  861.                                                 ),
  862.                 'INDEX'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  863.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::INDEX',
  864.                                                  'argumentCount'    =>    '1-4'
  865.                                                 ),
  866.                 'INDIRECT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  867.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::INDIRECT',
  868.                                                  'argumentCount'    =>    '1,2',
  869.                                                  'passCellReference'=>    true
  870.                                                 ),
  871.                 'INFO'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  872.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  873.                                                  'argumentCount'    =>    '1'
  874.                                                 ),
  875.                 'INT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  876.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::INTVALUE',
  877.                                                  'argumentCount'    =>    '1'
  878.                                                 ),
  879.                 'INTERCEPT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  880.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::INTERCEPT',
  881.                                                  'argumentCount'    =>    '2'
  882.                                                 ),
  883.                 'INTRATE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  884.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::INTRATE',
  885.                                                  'argumentCount'    =>    '4,5'
  886.                                                 ),
  887.                 'IPMT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  888.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IPMT',
  889.                                                  'argumentCount'    =>    '4-6'
  890.                                                 ),
  891.                 'IRR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  892.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IRR',
  893.                                                  'argumentCount'    =>    '1,2'
  894.                                                 ),
  895.                 'ISBLANK'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  896.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IS_BLANK',
  897.                                                  'argumentCount'    =>    '1'
  898.                                                 ),
  899.                 'ISERR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  900.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IS_ERR',
  901.                                                  'argumentCount'    =>    '1'
  902.                                                 ),
  903.                 'ISERROR'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  904.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IS_ERROR',
  905.                                                  'argumentCount'    =>    '1'
  906.                                                 ),
  907.                 'ISEVEN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  908.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IS_EVEN',
  909.                                                  'argumentCount'    =>    '1'
  910.                                                 ),
  911.                 'ISLOGICAL'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  912.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IS_LOGICAL',
  913.                                                  'argumentCount'    =>    '1'
  914.                                                 ),
  915.                 'ISNA'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  916.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IS_NA',
  917.                                                  'argumentCount'    =>    '1'
  918.                                                 ),
  919.                 'ISNONTEXT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  920.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IS_NONTEXT',
  921.                                                  'argumentCount'    =>    '1'
  922.                                                 ),
  923.                 'ISNUMBER'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  924.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IS_NUMBER',
  925.                                                  'argumentCount'    =>    '1'
  926.                                                 ),
  927.                 'ISODD'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  928.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IS_ODD',
  929.                                                  'argumentCount'    =>    '1'
  930.                                                 ),
  931.                 'ISPMT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  932.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ISPMT',
  933.                                                  'argumentCount'    =>    '4'
  934.                                                 ),
  935.                 'ISREF'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  936.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  937.                                                  'argumentCount'    =>    '1'
  938.                                                 ),
  939.                 'ISTEXT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  940.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::IS_TEXT',
  941.                                                  'argumentCount'    =>    '1'
  942.                                                 ),
  943.                 'JIS'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  944.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  945.                                                  'argumentCount'    =>    '1'
  946.                                                 ),
  947.                 'KURT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  948.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::KURT',
  949.                                                  'argumentCount'    =>    '1+'
  950.                                                 ),
  951.                 'LARGE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  952.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LARGE',
  953.                                                  'argumentCount'    =>    '2'
  954.                                                 ),
  955.                 'LCM'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  956.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LCM',
  957.                                                  'argumentCount'    =>    '1+'
  958.                                                 ),
  959.                 'LEFT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  960.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LEFT',
  961.                                                  'argumentCount'    =>    '1,2'
  962.                                                 ),
  963.                 'LEFTB'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  964.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LEFT',
  965.                                                  'argumentCount'    =>    '1,2'
  966.                                                 ),
  967.                 'LEN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  968.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::STRINGLENGTH',
  969.                                                  'argumentCount'    =>    '1'
  970.                                                 ),
  971.                 'LENB'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  972.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::STRINGLENGTH',
  973.                                                  'argumentCount'    =>    '1'
  974.                                                 ),
  975.                 'LINEST'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  976.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LINEST',
  977.                                                  'argumentCount'    =>    '1-4'
  978.                                                 ),
  979.                 'LN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  980.                                                  'functionCall'        =>    'log',
  981.                                                  'argumentCount'    =>    '1'
  982.                                                 ),
  983.                 'LOG'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  984.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LOG_BASE',
  985.                                                  'argumentCount'    =>    '1,2'
  986.                                                 ),
  987.                 'LOG10'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  988.                                                  'functionCall'        =>    'log10',
  989.                                                  'argumentCount'    =>    '1'
  990.                                                 ),
  991.                 'LOGEST'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  992.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LOGEST',
  993.                                                  'argumentCount'    =>    '1-4'
  994.                                                 ),
  995.                 'LOGINV'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  996.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LOGINV',
  997.                                                  'argumentCount'    =>    '3'
  998.                                                 ),
  999.                 'LOGNORMDIST'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1000.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LOGNORMDIST',
  1001.                                                  'argumentCount'    =>    '3'
  1002.                                                 ),
  1003.                 'LOOKUP'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  1004.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LOOKUP',
  1005.                                                  'argumentCount'    =>    '2,3'
  1006.                                                 ),
  1007.                 'LOWER'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1008.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LOWERCASE',
  1009.                                                  'argumentCount'    =>    '1'
  1010.                                                 ),
  1011.                 'MATCH'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  1012.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MATCH',
  1013.                                                  'argumentCount'    =>    '2,3'
  1014.                                                 ),
  1015.                 'MAX'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1016.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MAX',
  1017.                                                  'argumentCount'    =>    '1+'
  1018.                                                 ),
  1019.                 'MAXA'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1020.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MAXA',
  1021.                                                  'argumentCount'    =>    '1+'
  1022.                                                 ),
  1023.                 'MAXIF'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1024.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1025.                                                  'argumentCount'    =>    '2+'
  1026.                                                 ),
  1027.                 'MDETERM'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1028.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MDETERM',
  1029.                                                  'argumentCount'    =>    '1'
  1030.                                                 ),
  1031.                 'MDURATION'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1032.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1033.                                                  'argumentCount'    =>    '5,6'
  1034.                                                 ),
  1035.                 'MEDIAN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1036.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MEDIAN',
  1037.                                                  'argumentCount'    =>    '1+'
  1038.                                                 ),
  1039.                 'MEDIANIF'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1040.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1041.                                                  'argumentCount'    =>    '2+'
  1042.                                                 ),
  1043.                 'MID'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1044.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MID',
  1045.                                                  'argumentCount'    =>    '3'
  1046.                                                 ),
  1047.                 'MIDB'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1048.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MID',
  1049.                                                  'argumentCount'    =>    '3'
  1050.                                                 ),
  1051.                 'MIN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1052.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MIN',
  1053.                                                  'argumentCount'    =>    '1+'
  1054.                                                 ),
  1055.                 'MINA'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1056.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MINA',
  1057.                                                  'argumentCount'    =>    '1+'
  1058.                                                 ),
  1059.                 'MINIF'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1060.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1061.                                                  'argumentCount'    =>    '2+'
  1062.                                                 ),
  1063.                 'MINUTE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1064.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MINUTEOFHOUR',
  1065.                                                  'argumentCount'    =>    '1'
  1066.                                                 ),
  1067.                 'MINVERSE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1068.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MINVERSE',
  1069.                                                  'argumentCount'    =>    '1'
  1070.                                                 ),
  1071.                 'MIRR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1072.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MIRR',
  1073.                                                  'argumentCount'    =>    '3'
  1074.                                                 ),
  1075.                 'MMULT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1076.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MMULT',
  1077.                                                  'argumentCount'    =>    '2'
  1078.                                                 ),
  1079.                 'MOD'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1080.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MOD',
  1081.                                                  'argumentCount'    =>    '2'
  1082.                                                 ),
  1083.                 'MODE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1084.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MODE',
  1085.                                                  'argumentCount'    =>    '1+'
  1086.                                                 ),
  1087.                 'MONTH'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1088.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MONTHOFYEAR',
  1089.                                                  'argumentCount'    =>    '1'
  1090.                                                 ),
  1091.                 'MROUND'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1092.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MROUND',
  1093.                                                  'argumentCount'    =>    '2'
  1094.                                                 ),
  1095.                 'MULTINOMIAL'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1096.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::MULTINOMIAL',
  1097.                                                  'argumentCount'    =>    '1+'
  1098.                                                 ),
  1099.                 'N'                        => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  1100.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::N',
  1101.                                                  'argumentCount'    =>    '1'
  1102.                                                 ),
  1103.                 'NA'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  1104.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::NA',
  1105.                                                  'argumentCount'    =>    '0'
  1106.                                                 ),
  1107.                 'NEGBINOMDIST'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1108.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::NEGBINOMDIST',
  1109.                                                  'argumentCount'    =>    '3'
  1110.                                                 ),
  1111.                 'NETWORKDAYS'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1112.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::NETWORKDAYS',
  1113.                                                  'argumentCount'    =>    '2+'
  1114.                                                 ),
  1115.                 'NOMINAL'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1116.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::NOMINAL',
  1117.                                                  'argumentCount'    =>    '2'
  1118.                                                 ),
  1119.                 'NORMDIST'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1120.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::NORMDIST',
  1121.                                                  'argumentCount'    =>    '4'
  1122.                                                 ),
  1123.                 'NORMINV'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1124.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::NORMINV',
  1125.                                                  'argumentCount'    =>    '3'
  1126.                                                 ),
  1127.                 'NORMSDIST'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1128.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::NORMSDIST',
  1129.                                                  'argumentCount'    =>    '1'
  1130.                                                 ),
  1131.                 'NORMSINV'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1132.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::NORMSINV',
  1133.                                                  'argumentCount'    =>    '1'
  1134.                                                 ),
  1135.                 'NOT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
  1136.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LOGICAL_NOT',
  1137.                                                  'argumentCount'    =>    '1'
  1138.                                                 ),
  1139.                 'NOW'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1140.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DATETIMENOW',
  1141.                                                  'argumentCount'    =>    '0'
  1142.                                                 ),
  1143.                 'NPER'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1144.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::NPER',
  1145.                                                  'argumentCount'    =>    '3-5'
  1146.                                                 ),
  1147.                 'NPV'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1148.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::NPV',
  1149.                                                  'argumentCount'    =>    '2+'
  1150.                                                 ),
  1151.                 'OCT2BIN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  1152.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::OCTTOBIN',
  1153.                                                  'argumentCount'    =>    '1,2'
  1154.                                                 ),
  1155.                 'OCT2DEC'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  1156.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::OCTTODEC',
  1157.                                                  'argumentCount'    =>    '1'
  1158.                                                 ),
  1159.                 'OCT2HEX'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
  1160.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::OCTTOHEX',
  1161.                                                  'argumentCount'    =>    '1,2'
  1162.                                                 ),
  1163.                 'ODD'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1164.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ODD',
  1165.                                                  'argumentCount'    =>    '1'
  1166.                                                 ),
  1167.                 'ODDFPRICE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1168.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1169.                                                  'argumentCount'    =>    '8,9'
  1170.                                                 ),
  1171.                 'ODDFYIELD'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1172.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1173.                                                  'argumentCount'    =>    '8,9'
  1174.                                                 ),
  1175.                 'ODDLPRICE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1176.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1177.                                                  'argumentCount'    =>    '7,8'
  1178.                                                 ),
  1179.                 'ODDLYIELD'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1180.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1181.                                                  'argumentCount'    =>    '7,8'
  1182.                                                 ),
  1183.                 'OFFSET'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  1184.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::OFFSET',
  1185.                                                  'argumentCount'    =>    '3,5',
  1186.                                                  'passCellReference'=>    true,
  1187.                                                  'passByReference'    =>    array(true)
  1188.                                                 ),
  1189.                 'OR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
  1190.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LOGICAL_OR',
  1191.                                                  'argumentCount'    =>    '1+'
  1192.                                                 ),
  1193.                 'PEARSON'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1194.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::CORREL',
  1195.                                                  'argumentCount'    =>    '2'
  1196.                                                 ),
  1197.                 'PERCENTILE'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1198.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::PERCENTILE',
  1199.                                                  'argumentCount'    =>    '2'
  1200.                                                 ),
  1201.                 'PERCENTRANK'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1202.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::PERCENTRANK',
  1203.                                                  'argumentCount'    =>    '2,3'
  1204.                                                 ),
  1205.                 'PERMUT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1206.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::PERMUT',
  1207.                                                  'argumentCount'    =>    '2'
  1208.                                                 ),
  1209.                 'PHONETIC'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1210.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1211.                                                  'argumentCount'    =>    '1'
  1212.                                                 ),
  1213.                 'PI'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1214.                                                  'functionCall'        =>    'pi',
  1215.                                                  'argumentCount'    =>    '0'
  1216.                                                 ),
  1217.                 'PMT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1218.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::PMT',
  1219.                                                  'argumentCount'    =>    '3-5'
  1220.                                                 ),
  1221.                 'POISSON'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1222.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::POISSON',
  1223.                                                  'argumentCount'    =>    '3'
  1224.                                                 ),
  1225.                 'POWER'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1226.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::POWER',
  1227.                                                  'argumentCount'    =>    '2'
  1228.                                                 ),
  1229.                 'PPMT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1230.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::PPMT',
  1231.                                                  'argumentCount'    =>    '4-6'
  1232.                                                 ),
  1233.                 'PRICE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1234.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::PRICE',
  1235.                                                  'argumentCount'    =>    '6,7'
  1236.                                                 ),
  1237.                 'PRICEDISC'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1238.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::PRICEDISC',
  1239.                                                  'argumentCount'    =>    '4,5'
  1240.                                                 ),
  1241.                 'PRICEMAT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1242.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::PRICEMAT',
  1243.                                                  'argumentCount'    =>    '5,6'
  1244.                                                 ),
  1245.                 'PROB'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1246.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1247.                                                  'argumentCount'    =>    '3,4'
  1248.                                                 ),
  1249.                 'PRODUCT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1250.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::PRODUCT',
  1251.                                                  'argumentCount'    =>    '1+'
  1252.                                                 ),
  1253.                 'PROPER'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1254.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::PROPERCASE',
  1255.                                                  'argumentCount'    =>    '1'
  1256.                                                 ),
  1257.                 'PV'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1258.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::PV',
  1259.                                                  'argumentCount'    =>    '3-5'
  1260.                                                 ),
  1261.                 'QUARTILE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1262.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::QUARTILE',
  1263.                                                  'argumentCount'    =>    '2'
  1264.                                                 ),
  1265.                 'QUOTIENT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1266.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::QUOTIENT',
  1267.                                                  'argumentCount'    =>    '2'
  1268.                                                 ),
  1269.                 'RADIANS'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1270.                                                  'functionCall'        =>    'deg2rad',
  1271.                                                  'argumentCount'    =>    '1'
  1272.                                                 ),
  1273.                 'RAND'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1274.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::RAND',
  1275.                                                  'argumentCount'    =>    '0'
  1276.                                                 ),
  1277.                 'RANDBETWEEN'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1278.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::RAND',
  1279.                                                  'argumentCount'    =>    '2'
  1280.                                                 ),
  1281.                 'RANK'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1282.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::RANK',
  1283.                                                  'argumentCount'    =>    '2,3'
  1284.                                                 ),
  1285.                 'RATE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1286.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::RATE',
  1287.                                                  'argumentCount'    =>    '3-6'
  1288.                                                 ),
  1289.                 'RECEIVED'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1290.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::RECEIVED',
  1291.                                                  'argumentCount'    =>    '4-5'
  1292.                                                 ),
  1293.                 'REPLACE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1294.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::REPLACE',
  1295.                                                  'argumentCount'    =>    '4'
  1296.                                                 ),
  1297.                 'REPLACEB'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1298.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::REPLACE',
  1299.                                                  'argumentCount'    =>    '4'
  1300.                                                 ),
  1301.                 'REPT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1302.                                                  'functionCall'        =>    'str_repeat',
  1303.                                                  'argumentCount'    =>    '2'
  1304.                                                 ),
  1305.                 'RIGHT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1306.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::RIGHT',
  1307.                                                  'argumentCount'    =>    '1,2'
  1308.                                                 ),
  1309.                 'RIGHTB'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1310.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::RIGHT',
  1311.                                                  'argumentCount'    =>    '1,2'
  1312.                                                 ),
  1313.                 'ROMAN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1314.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ROMAN',
  1315.                                                  'argumentCount'    =>    '1,2'
  1316.                                                 ),
  1317.                 'ROUND'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1318.                                                  'functionCall'        =>    'round',
  1319.                                                  'argumentCount'    =>    '2'
  1320.                                                 ),
  1321.                 'ROUNDDOWN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1322.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ROUNDDOWN',
  1323.                                                  'argumentCount'    =>    '2'
  1324.                                                 ),
  1325.                 'ROUNDUP'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1326.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ROUNDUP',
  1327.                                                  'argumentCount'    =>    '2'
  1328.                                                 ),
  1329.                 'ROW'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  1330.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ROW',
  1331.                                                  'argumentCount'    =>    '-1',
  1332.                                                  'passByReference'    =>    array(true)
  1333.                                                 ),
  1334.                 'ROWS'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  1335.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ROWS',
  1336.                                                  'argumentCount'    =>    '1'
  1337.                                                 ),
  1338.                 'RSQ'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1339.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::RSQ',
  1340.                                                  'argumentCount'    =>    '2'
  1341.                                                 ),
  1342.                 'RTD'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  1343.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1344.                                                  'argumentCount'    =>    '1+'
  1345.                                                 ),
  1346.                 'SEARCH'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1347.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SEARCHINSENSITIVE',
  1348.                                                  'argumentCount'    =>    '2,3'
  1349.                                                 ),
  1350.                 'SEARCHB'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1351.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SEARCHINSENSITIVE',
  1352.                                                  'argumentCount'    =>    '2,3'
  1353.                                                 ),
  1354.                 'SECOND'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1355.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SECONDOFMINUTE',
  1356.                                                  'argumentCount'    =>    '1'
  1357.                                                 ),
  1358.                 'SERIESSUM'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1359.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SERIESSUM',
  1360.                                                  'argumentCount'    =>    '4'
  1361.                                                 ),
  1362.                 'SIGN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1363.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SIGN',
  1364.                                                  'argumentCount'    =>    '1'
  1365.                                                 ),
  1366.                 'SIN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1367.                                                  'functionCall'        =>    'sin',
  1368.                                                  'argumentCount'    =>    '1'
  1369.                                                 ),
  1370.                 'SINH'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1371.                                                  'functionCall'        =>    'sinh',
  1372.                                                  'argumentCount'    =>    '1'
  1373.                                                 ),
  1374.                 'SKEW'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1375.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SKEW',
  1376.                                                  'argumentCount'    =>    '1+'
  1377.                                                 ),
  1378.                 'SLN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1379.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SLN',
  1380.                                                  'argumentCount'    =>    '3'
  1381.                                                 ),
  1382.                 'SLOPE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1383.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SLOPE',
  1384.                                                  'argumentCount'    =>    '2'
  1385.                                                 ),
  1386.                 'SMALL'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1387.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SMALL',
  1388.                                                  'argumentCount'    =>    '2'
  1389.                                                 ),
  1390.                 'SQRT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1391.                                                  'functionCall'        =>    'sqrt',
  1392.                                                  'argumentCount'    =>    '1'
  1393.                                                 ),
  1394.                 'SQRTPI'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1395.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SQRTPI',
  1396.                                                  'argumentCount'    =>    '1'
  1397.                                                 ),
  1398.                 'STANDARDIZE'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1399.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::STANDARDIZE',
  1400.                                                  'argumentCount'    =>    '3'
  1401.                                                 ),
  1402.                 'STDEV'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1403.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::STDEV',
  1404.                                                  'argumentCount'    =>    '1+'
  1405.                                                 ),
  1406.                 'STDEVA'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1407.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::STDEVA',
  1408.                                                  'argumentCount'    =>    '1+'
  1409.                                                 ),
  1410.                 'STDEVP'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1411.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::STDEVP',
  1412.                                                  'argumentCount'    =>    '1+'
  1413.                                                 ),
  1414.                 'STDEVPA'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1415.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::STDEVPA',
  1416.                                                  'argumentCount'    =>    '1+'
  1417.                                                 ),
  1418.                 'STEYX'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1419.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::STEYX',
  1420.                                                  'argumentCount'    =>    '2'
  1421.                                                 ),
  1422.                 'SUBSTITUTE'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1423.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SUBSTITUTE',
  1424.                                                  'argumentCount'    =>    '3,4'
  1425.                                                 ),
  1426.                 'SUBTOTAL'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1427.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SUBTOTAL',
  1428.                                                  'argumentCount'    =>    '2+'
  1429.                                                 ),
  1430.                 'SUM'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1431.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SUM',
  1432.                                                  'argumentCount'    =>    '1+'
  1433.                                                 ),
  1434.                 'SUMIF'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1435.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SUMIF',
  1436.                                                  'argumentCount'    =>    '2,3'
  1437.                                                 ),
  1438.                 'SUMIFS'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1439.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1440.                                                  'argumentCount'    =>    '?'
  1441.                                                 ),
  1442.                 'SUMPRODUCT'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1443.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SUMPRODUCT',
  1444.                                                  'argumentCount'    =>    '1+'
  1445.                                                 ),
  1446.                 'SUMSQ'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1447.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SUMSQ',
  1448.                                                  'argumentCount'    =>    '1+'
  1449.                                                 ),
  1450.                 'SUMX2MY2'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1451.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SUMX2MY2',
  1452.                                                  'argumentCount'    =>    '2'
  1453.                                                 ),
  1454.                 'SUMX2PY2'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1455.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SUMX2PY2',
  1456.                                                  'argumentCount'    =>    '2'
  1457.                                                 ),
  1458.                 'SUMXMY2'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1459.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SUMXMY2',
  1460.                                                  'argumentCount'    =>    '2'
  1461.                                                 ),
  1462.                 'SYD'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1463.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::SYD',
  1464.                                                  'argumentCount'    =>    '4'
  1465.                                                 ),
  1466.                 'T'                        => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1467.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::RETURNSTRING',
  1468.                                                  'argumentCount'    =>    '1'
  1469.                                                 ),
  1470.                 'TAN'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1471.                                                  'functionCall'        =>    'tan',
  1472.                                                  'argumentCount'    =>    '1'
  1473.                                                 ),
  1474.                 'TANH'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1475.                                                  'functionCall'        =>    'tanh',
  1476.                                                  'argumentCount'    =>    '1'
  1477.                                                 ),
  1478.                 'TBILLEQ'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1479.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TBILLEQ',
  1480.                                                  'argumentCount'    =>    '3'
  1481.                                                 ),
  1482.                 'TBILLPRICE'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1483.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TBILLPRICE',
  1484.                                                  'argumentCount'    =>    '3'
  1485.                                                 ),
  1486.                 'TBILLYIELD'            => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1487.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TBILLYIELD',
  1488.                                                  'argumentCount'    =>    '3'
  1489.                                                 ),
  1490.                 'TDIST'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1491.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TDIST',
  1492.                                                  'argumentCount'    =>    '3'
  1493.                                                 ),
  1494.                 'TEXT'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1495.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TEXTFORMAT',
  1496.                                                  'argumentCount'    =>    '2'
  1497.                                                 ),
  1498.                 'TIME'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1499.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TIME',
  1500.                                                  'argumentCount'    =>    '3'
  1501.                                                 ),
  1502.                 'TIMEVALUE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1503.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TIMEVALUE',
  1504.                                                  'argumentCount'    =>    '1'
  1505.                                                 ),
  1506.                 'TINV'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1507.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TINV',
  1508.                                                  'argumentCount'    =>    '2'
  1509.                                                 ),
  1510.                 'TODAY'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1511.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DATENOW',
  1512.                                                  'argumentCount'    =>    '0'
  1513.                                                 ),
  1514.                 'TRANSPOSE'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  1515.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TRANSPOSE',
  1516.                                                  'argumentCount'    =>    '1'
  1517.                                                 ),
  1518.                 'TREND'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1519.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TREND',
  1520.                                                  'argumentCount'    =>    '1-4'
  1521.                                                 ),
  1522.                 'TRIM'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1523.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TRIMSPACES',
  1524.                                                  'argumentCount'    =>    '1'
  1525.                                                 ),
  1526.                 'TRIMMEAN'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1527.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TRIMMEAN',
  1528.                                                  'argumentCount'    =>    '2'
  1529.                                                 ),
  1530.                 'TRUE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
  1531.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::LOGICAL_TRUE',
  1532.                                                  'argumentCount'    =>    '0'
  1533.                                                 ),
  1534.                 'TRUNC'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
  1535.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TRUNC',
  1536.                                                  'argumentCount'    =>    '1,2'
  1537.                                                 ),
  1538.                 'TTEST'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1539.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1540.                                                  'argumentCount'    =>    '4'
  1541.                                                 ),
  1542.                 'TYPE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  1543.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::TYPE',
  1544.                                                  'argumentCount'    =>    '1'
  1545.                                                 ),
  1546.                 'UPPER'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1547.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::UPPERCASE',
  1548.                                                  'argumentCount'    =>    '1'
  1549.                                                 ),
  1550.                 'USDOLLAR'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1551.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1552.                                                  'argumentCount'    =>    '2'
  1553.                                                 ),
  1554.                 'VALUE'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
  1555.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1556.                                                  'argumentCount'    =>    '1'
  1557.                                                 ),
  1558.                 'VAR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1559.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::VARFunc',
  1560.                                                  'argumentCount'    =>    '1+'
  1561.                                                 ),
  1562.                 'VARA'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1563.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::VARA',
  1564.                                                  'argumentCount'    =>    '1+'
  1565.                                                 ),
  1566.                 'VARP'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1567.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::VARP',
  1568.                                                  'argumentCount'    =>    '1+'
  1569.                                                 ),
  1570.                 'VARPA'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1571.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::VARPA',
  1572.                                                  'argumentCount'    =>    '1+'
  1573.                                                 ),
  1574.                 'VDB'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1575.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1576.                                                  'argumentCount'    =>    '5-7'
  1577.                                                 ),
  1578.                 'VERSION'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
  1579.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::VERSION',
  1580.                                                  'argumentCount'    =>    '0'
  1581.                                                 ),
  1582.                 'VLOOKUP'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
  1583.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::VLOOKUP',
  1584.                                                  'argumentCount'    =>    '3,4'
  1585.                                                 ),
  1586.                 'WEEKDAY'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1587.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DAYOFWEEK',
  1588.                                                  'argumentCount'    =>    '1,2'
  1589.                                                 ),
  1590.                 'WEEKNUM'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1591.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::WEEKOFYEAR',
  1592.                                                  'argumentCount'    =>    '1,2'
  1593.                                                 ),
  1594.                 'WEIBULL'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1595.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::WEIBULL',
  1596.                                                  'argumentCount'    =>    '4'
  1597.                                                 ),
  1598.                 'WORKDAY'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1599.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::WORKDAY',
  1600.                                                  'argumentCount'    =>    '2+'
  1601.                                                 ),
  1602.                 'XIRR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1603.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::XIRR',
  1604.                                                  'argumentCount'    =>    '2,3'
  1605.                                                 ),
  1606.                 'XNPV'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1607.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::XNPV',
  1608.                                                  'argumentCount'    =>    '3'
  1609.                                                 ),
  1610.                 'YEAR'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1611.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::YEAR',
  1612.                                                  'argumentCount'    =>    '1'
  1613.                                                 ),
  1614.                 'YEARFRAC'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
  1615.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::YEARFRAC',
  1616.                                                  'argumentCount'    =>    '2,3'
  1617.                                                 ),
  1618.                 'YIELD'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1619.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::DUMMY',
  1620.                                                  'argumentCount'    =>    '6,7'
  1621.                                                 ),
  1622.                 'YIELDDISC'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1623.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::YIELDDISC',
  1624.                                                  'argumentCount'    =>    '4,5'
  1625.                                                 ),
  1626.                 'YIELDMAT'                => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
  1627.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::YIELDMAT',
  1628.                                                  'argumentCount'    =>    '5,6'
  1629.                                                 ),
  1630.                 'ZTEST'                    => array('category'            =>    PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
  1631.                                                  'functionCall'        =>    'PHPExcel_Calculation_Functions::ZTEST',
  1632.                                                  'argumentCount'    =>    '2-3'
  1633.                                                 )
  1634.             );
  1635.  
  1636.  
  1637.     //    Internal functions used for special control purposes
  1638.     private static $_controlFunctions array(
  1639.                 'MKMATRIX'    => array('argumentCount'    =>    '*',
  1640.                                      'functionCall'        =>    'self::_mkMatrix'
  1641.                                     )
  1642.             );
  1643.  
  1644.  
  1645.  
  1646.  
  1647.     function __construct({
  1648.         $localeFileDirectory PHPEXCEL_ROOT.'PHPExcel/locale/';
  1649.         foreach (glob($localeFileDirectory.'/*',GLOB_ONLYDIRas $filename{
  1650.             $filename substr($filename,strlen($localeFileDirectory)+1);
  1651.             if ($filename != 'en'{
  1652.                 self::$_validLocaleLanguages[$filename;
  1653.             }
  1654.         }
  1655.     }    //    function __construct()
  1656.  
  1657.  
  1658.     /**
  1659.      *    Get an instance of this class
  1660.      *
  1661.      *    @access    public
  1662.      *    @return PHPExcel_Calculation 
  1663.      */
  1664.     public static function getInstance({
  1665.         if (!isset(self::$_instance|| is_null(self::$_instance)) {
  1666.             self::$_instance new PHPExcel_Calculation();
  1667.         }
  1668.  
  1669.         return self::$_instance;
  1670.     }    //    function getInstance()
  1671.  
  1672.  
  1673.     /**
  1674.      *    __clone implementation. Cloning should not be allowed in a Singleton!
  1675.      *
  1676.      *    @access    public
  1677.      *    @throws    Exception
  1678.      */
  1679.     public final function __clone({
  1680.         throw new Exception ('Cloning a Singleton is not allowed!');
  1681.     }    //    function __clone()
  1682.  
  1683.  
  1684.     /**
  1685.      *    Set the Array Return Type (Array or Value of first element in the array)
  1686.      *
  1687.      *    @access    public
  1688.      *    @param     string    $returnType            Array return type
  1689.      *    @return     boolean                    Success or failure
  1690.      */
  1691.     public static function setArrayReturnType($returnType{
  1692.         if (($returnType == self::RETURN_ARRAY_AS_VALUE||
  1693.             ($returnType == self::RETURN_ARRAY_AS_ERROR||
  1694.             ($returnType == self::RETURN_ARRAY_AS_ARRAY)) {
  1695.             self::$returnArrayAsType $returnType;
  1696.             return True;
  1697.         }
  1698.         return False;
  1699.     }    //    function setExcelCalendar()
  1700.  
  1701.  
  1702.     /**
  1703.      *    Return the Array Return Type (Array or Value of first element in the array)
  1704.      *
  1705.      *    @access    public
  1706.      *    @return     string        $returnType            Array return type
  1707.      */
  1708.     public static function getArrayReturnType({
  1709.         return self::$returnArrayAsType;
  1710.     }    //    function getExcelCalendar()
  1711.  
  1712.  
  1713.     /**
  1714.      *    Is calculation caching enabled?
  1715.      *
  1716.      *    @access    public
  1717.      *    @return boolean 
  1718.      */
  1719.     public function getCalculationCacheEnabled({
  1720.         return self::$_calculationCacheEnabled;
  1721.     }    //    function getCalculationCacheEnabled()
  1722.  
  1723.  
  1724.     /**
  1725.      *    Enable/disable calculation cache
  1726.      *
  1727.      *    @access    public
  1728.      *    @param boolean $pValue 
  1729.      */
  1730.     public function setCalculationCacheEnabled($pValue true{
  1731.         self::$_calculationCacheEnabled $pValue;
  1732.         $this->clearCalculationCache();
  1733.     }    //    function setCalculationCacheEnabled()
  1734.  
  1735.  
  1736.     /**
  1737.      *    Enable calculation cache
  1738.      */
  1739.     public function enableCalculationCache({
  1740.         $this->setCalculationCacheEnabled(true);
  1741.     }    //    function enableCalculationCache()
  1742.  
  1743.  
  1744.     /**
  1745.      *    Disable calculation cache
  1746.      */
  1747.     public function disableCalculationCache({
  1748.         $this->setCalculationCacheEnabled(false);
  1749.     }    //    function disableCalculationCache()
  1750.  
  1751.  
  1752.     /**
  1753.      *    Clear calculation cache
  1754.      */
  1755.     public function clearCalculationCache({
  1756.         self::$_calculationCache array();
  1757.     }    //    function clearCalculationCache()
  1758.  
  1759.  
  1760.     /**
  1761.      *    Get calculation cache expiration time
  1762.      *
  1763.      *    @return float 
  1764.      */
  1765.     public function getCalculationCacheExpirationTime({
  1766.         return self::$_calculationCacheExpirationTime;
  1767.     }    //    getCalculationCacheExpirationTime()
  1768.  
  1769.  
  1770.     /**
  1771.      *    Set calculation cache expiration time
  1772.      *
  1773.      *    @param float $pValue 
  1774.      */
  1775.     public function setCalculationCacheExpirationTime($pValue 2.5{
  1776.         self::$_calculationCacheExpirationTime $pValue;
  1777.     }    //    function setCalculationCacheExpirationTime()
  1778.  
  1779.  
  1780.  
  1781.  
  1782.     /**
  1783.      *    Get the currently defined locale code
  1784.      *
  1785.      *    @return string 
  1786.      */
  1787.     public function getLocale({
  1788.         return self::$_localeLanguage;
  1789.     }    //    function getLocale()
  1790.  
  1791.  
  1792.     /**
  1793.      *    Set the locale code
  1794.      *
  1795.      *    @return boolean 
  1796.      */
  1797.     public function setLocale($locale='en_us'{
  1798.         //    Identify our locale and language
  1799.         $language $locale strtolower($locale);
  1800.         if (strpos($locale,'_'!== false{
  1801.             list($languageexplode('_',$locale);
  1802.         }
  1803.  
  1804.         //    Test whether we have any language data for this language (any locale)
  1805.         if (in_array($language,self::$_validLocaleLanguages)) {
  1806.             //    initialise language/locale settings
  1807.             self::$_localeFunctions array();
  1808.             self::$_localeArgumentSeparator ',';
  1809.             self::$_localeBoolean array('TRUE' => 'TRUE''FALSE' => 'FALSE''NULL' => 'NULL');
  1810.             //    Default is English, if user isn't requesting english, then read the necessary data from the locale files
  1811.             if ($locale != 'en_us'{
  1812.                 //    Search for a file with a list of function names for locale
  1813.                 $functionNamesFile PHPEXCEL_ROOT 'PHPExcel/locale/'.str_replace('_','/',$locale).'/functions';
  1814.                 if (!file_exists($functionNamesFile)) {
  1815.                     //    If there isn't a locale specific function file, look for a language specific function file
  1816.                     $functionNamesFile PHPEXCEL_ROOT 'PHPExcel/locale/'.$language.'/functions';
  1817.                     if (!file_exists($functionNamesFile)) {
  1818.                         return false;
  1819.                     }
  1820.                 }
  1821.                 //    Retrieve the list of locale or language specific function names
  1822.                 $localeFunctions file($functionNamesFile,FILE_IGNORE_NEW_LINES FILE_SKIP_EMPTY_LINES);
  1823.                 foreach ($localeFunctions as $localeFunction{
  1824.                     list($localeFunctionexplode('##',$localeFunction);    //    Strip out comments
  1825.                     if (strpos($localeFunction,'='!== false{
  1826.                         list($fName,$lfNameexplode('=',$localeFunction);
  1827.                         $fName trim($fName);
  1828.                         $lfName trim($lfName);
  1829.                         if ((isset(self::$_PHPExcelFunctions[$fName])) && ($lfName != ''&& ($fName != $lfName)) {
  1830.                             self::$_localeFunctions[$fName$lfName;
  1831.                         }
  1832.                     }
  1833.                 }
  1834.                 //    Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions
  1835.                 if (isset(self::$_localeFunctions['TRUE'])) self::$_localeBoolean['TRUE'self::$_localeFunctions['TRUE']}
  1836.                 if (isset(self::$_localeFunctions['FALSE'])) self::$_localeBoolean['FALSE'self::$_localeFunctions['FALSE']}
  1837.  
  1838.                 $configFile PHPEXCEL_ROOT 'PHPExcel/locale/'.str_replace('_','/',$locale).'/config';
  1839.                 if (!file_exists($configFile)) {
  1840.                     $configFile PHPEXCEL_ROOT 'PHPExcel/locale/'.$language.'/config';
  1841.                 }
  1842.                 if (file_exists($configFile)) {
  1843.                     $localeSettings file($configFile,FILE_IGNORE_NEW_LINES FILE_SKIP_EMPTY_LINES);
  1844.                     foreach ($localeSettings as $localeSetting{
  1845.                         list($localeSettingexplode('##',$localeSetting);    //    Strip out comments
  1846.                         if (strpos($localeSetting,'='!== false{
  1847.                             list($settingName,$settingValueexplode('=',$localeSetting);
  1848.                             $settingName strtoupper(trim($settingName));
  1849.                             switch ($settingName{
  1850.                                 case 'ARGUMENTSEPARATOR' :
  1851.                                     self::$_localeArgumentSeparator trim($settingValue);
  1852.                                     break;
  1853.                             }
  1854.                         }
  1855.                     }
  1856.                 }
  1857.             }
  1858.  
  1859.             self::$functionReplaceFromExcel self::$functionReplaceToExcel =
  1860.             self::$functionReplaceFromLocale self::$functionReplaceToLocale NULL;
  1861.             self::$_localeLanguage $locale;
  1862.             return true;
  1863.         }
  1864.         return false;
  1865.     }    //    function setLocale()
  1866.  
  1867.  
  1868.  
  1869.     public static function _translateSeparator($fromSeparator,$toSeparator,$formula,&$inBraces{
  1870.         $strlen mb_strlen($formula);
  1871.         for ($i 0$i $strlen++$i{
  1872.             $chr mb_substr($formula,$i,1);
  1873.             switch ($chr{
  1874.                 case '{' :    $inBraces True;
  1875.                             break;
  1876.                 case '}' :    $inBraces False;
  1877.                             break;
  1878.                 case $fromSeparator :
  1879.                             if (!$inBraces{
  1880.                                 $formula mb_substr($formula,0,$i).$toSeparator.mb_substr($formula,$i+1);
  1881.                             }
  1882.             }
  1883.         }
  1884.         return $formula;
  1885.     }
  1886.  
  1887.     private static function _translateFormula($from,$to,$formula,$fromSeparator,$toSeparator{
  1888.         $inBraces False;
  1889.         //    Convert any Excel function names to the required language
  1890.         if (self::$_localeLanguage !== 'en_us'{
  1891.             //    If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators
  1892.             if (strpos($formula,'"'!== false{
  1893.                 //    So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded
  1894.                 //        the formula
  1895.                 $temp explode('"',$formula);
  1896.                 foreach($temp as $i => &$value{
  1897.                     //    Only count/replace in alternate array entries
  1898.                     if (($i 2== 0{
  1899.                         $value preg_replace($from,$to,$value);
  1900.                         $value self::_translateSeparator($fromSeparator,$toSeparator,$value,$inBraces);
  1901.                     }
  1902.                 }
  1903.                 unset($value);
  1904.                 //    Then rebuild the formula string
  1905.                 $formula implode('"',$temp);
  1906.             else {
  1907.                 //    If there's no quoted strings, then we do a simple count/replace
  1908.                 $formula preg_replace($from,$to,$formula);
  1909.                 $formula self::_translateSeparator($fromSeparator,$toSeparator,$formula);
  1910.             }
  1911.         }
  1912.  
  1913.         return $formula;
  1914.     }
  1915.  
  1916.     private static $functionReplaceFromExcel    NULL;
  1917.     private static $functionReplaceToLocale        NULL;
  1918.  
  1919.     public function _translateFormulaToLocale($formula{
  1920.         if (is_null(self::$functionReplaceFromExcel)) {
  1921.             self::$functionReplaceFromExcel array();
  1922.             foreach(array_keys(self::$_localeFunctionsas $excelFunctionName{
  1923.                 self::$functionReplaceFromExcel['/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui';
  1924.             }
  1925.             foreach(array_keys(self::$_localeBooleanas $excelBoolean{
  1926.                 self::$functionReplaceFromExcel['/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
  1927.             }
  1928.  
  1929.         }
  1930.  
  1931.         if (is_null(self::$functionReplaceToLocale)) {
  1932.             self::$functionReplaceToLocale array();
  1933.             foreach(array_values(self::$_localeFunctionsas $localeFunctionName{
  1934.                 self::$functionReplaceToLocale['$1'.trim($localeFunctionName).'$2';
  1935.             }
  1936.             foreach(array_values(self::$_localeBooleanas $localeBoolean{
  1937.                 self::$functionReplaceToLocale['$1'.trim($localeBoolean).'$2';
  1938.             }
  1939.         }
  1940.  
  1941.         return self::_translateFormula(self::$functionReplaceFromExcel,self::$functionReplaceToLocale,$formula,',',self::$_localeArgumentSeparator);
  1942.     }    //    function _translateFormulaToLocale()
  1943.  
  1944.  
  1945.     private static $functionReplaceFromLocale    NULL;
  1946.     private static $functionReplaceToExcel        NULL;
  1947.  
  1948.     public function _translateFormulaToEnglish($formula{
  1949.         if (is_null(self::$functionReplaceFromLocale)) {
  1950.             self::$functionReplaceFromLocale array();
  1951.             foreach(array_values(self::$_localeFunctionsas $localeFunctionName{
  1952.                 self::$functionReplaceFromLocale['/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui';
  1953.             }
  1954.             foreach(array_values(self::$_localeBooleanas $excelBoolean{
  1955.                 self::$functionReplaceFromLocale['/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
  1956.             }
  1957.         }
  1958.  
  1959.         if (is_null(self::$functionReplaceToExcel)) {
  1960.             self::$functionReplaceToExcel array();
  1961.             foreach(array_keys(self::$_localeFunctionsas $excelFunctionName{
  1962.                 self::$functionReplaceToExcel['$1'.trim($excelFunctionName).'$2';
  1963.             }
  1964.             foreach(array_keys(self::$_localeBooleanas $excelBoolean{
  1965.                 self::$functionReplaceToExcel['$1'.trim($excelBoolean).'$2';
  1966.             }
  1967.         }
  1968.  
  1969.         return self::_translateFormula(self::$functionReplaceFromLocale,self::$functionReplaceToExcel,$formula,self::$_localeArgumentSeparator,',');
  1970.     }    //    function _translateFormulaToEnglish()
  1971.  
  1972.  
  1973.     public static function _localeFunc($function{
  1974.         if (self::$_localeLanguage !== 'en_us'{
  1975.             $functionName trim($function,'(');
  1976.             if (isset(self::$_localeFunctions[$functionName])) {
  1977.                 $brace ($functionName != $function);
  1978.                 $function self::$_localeFunctions[$functionName];
  1979.                 if ($brace$function .= '('}
  1980.             }
  1981.         }
  1982.         return $function;
  1983.     }
  1984.  
  1985.  
  1986.  
  1987.  
  1988.     /**
  1989.      *    Wrap string values in quotes
  1990.      *
  1991.      *    @param mixed $value 
  1992.      *    @return mixed 
  1993.      */
  1994.     public static function _wrapResult($value{
  1995.         if (is_string($value)) {
  1996.             //    Error values cannot be "wrapped"
  1997.             if (preg_match('/^'.self::CALCULATION_REGEXP_ERROR.'$/i'$value$match)) {
  1998.                 //    Return Excel errors "as is"
  1999.                 return $value;
  2000.             }
  2001.             //    Return strings wrapped in quotes
  2002.             return '"'.$value.'"';
  2003.         //    Convert numeric errors to NaN error
  2004.         else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
  2005.             return PHPExcel_Calculation_Functions::NaN();
  2006.         }
  2007.  
  2008.         return $value;
  2009.     }    //    function _wrapResult()
  2010.  
  2011.  
  2012.     /**
  2013.      *    Remove quotes used as a wrapper to identify string values
  2014.      *
  2015.      *    @param mixed $value 
  2016.      *    @return mixed 
  2017.      */
  2018.     public static function _unwrapResult($value{
  2019.         if (is_string($value)) {
  2020.             if ((strlen($value0&& ($value{0== '"'&& (substr($value,-1== '"')) {
  2021.                 return substr($value,1,-1);
  2022.             }
  2023.         //    Convert numeric errors to NaN error
  2024.         else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
  2025.             return PHPExcel_Calculation_Functions::NaN();
  2026.         }
  2027.         return $value;
  2028.     }    //    function _unwrapResult()
  2029.  
  2030.  
  2031.  
  2032.  
  2033.     /**
  2034.      *    Calculate cell value (using formula from a cell ID)
  2035.      *    Retained for backward compatibility
  2036.      *
  2037.      *    @access    public
  2038.      *    @param    PHPExcel_Cell    $pCell    Cell to calculate
  2039.      *    @return    mixed 
  2040.      *    @throws    Exception
  2041.      */
  2042.     public function calculate(PHPExcel_Cell $pCell null{
  2043.         try {
  2044.             return $this->calculateCellValue($pCell);
  2045.         catch (Exception $e{
  2046.             throw(new Exception($e->getMessage()));
  2047.         }
  2048.     }    //    function calculate()
  2049.  
  2050.  
  2051.     /**
  2052.      *    Calculate the value of a cell formula
  2053.      *
  2054.      *    @access    public
  2055.      *    @param    PHPExcel_Cell    $pCell        Cell to calculate
  2056.      *    @param    Boolean            $resetLog    Flag indicating whether the debug log should be reset or not
  2057.      *    @return    mixed 
  2058.      *    @throws    Exception
  2059.      */
  2060.     public function calculateCellValue(PHPExcel_Cell $pCell null$resetLog true{
  2061.         if ($resetLog{
  2062.             //    Initialise the logging settings if requested
  2063.             $this->formulaError = null;
  2064.             $this->debugLog = $this->debugLogStack array();
  2065.             $this->_cyclicFormulaCount 1;
  2066.  
  2067.             $returnArrayAsType self::$returnArrayAsType;
  2068.             self::$returnArrayAsType self::RETURN_ARRAY_AS_ARRAY;
  2069.         }
  2070.  
  2071.         //    Read the formula from the cell
  2072.         if (is_null($pCell)) {
  2073.             return null;
  2074.         }
  2075.  
  2076.         if ($resetLog{
  2077.             self::$returnArrayAsType $returnArrayAsType;
  2078.         }
  2079.         //    Execute the calculation for the cell formula
  2080.         try {
  2081.             $result self::_unwrapResult($this->_calculateFormulaValue($pCell->getValue()$pCell->getCoordinate()$pCell));
  2082.         catch (Exception $e{
  2083.             throw(new Exception($e->getMessage()));
  2084.         }
  2085.  
  2086.         if ((is_array($result)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) {
  2087.             $testResult PHPExcel_Calculation_Functions::flattenArray($result);
  2088.             if (self::$returnArrayAsType == self::RETURN_ARRAY_AS_ERROR{
  2089.                 return PHPExcel_Calculation_Functions::VALUE();
  2090.             }
  2091.             //    If there's only a single cell in the array, then we allow it
  2092.             if (count($testResult!= 1{
  2093.                 //    If keys are numeric, then it's a matrix result rather than a cell range result, so we permit it
  2094.                 $r array_keys($result);
  2095.                 $r array_shift($r);
  2096.                 if (!is_numeric($r)) return PHPExcel_Calculation_Functions::VALUE()}
  2097.                 if (is_array($result[$r])) {
  2098.                     $c array_keys($result[$r]);
  2099.                     $c array_shift($c);
  2100.                     if (!is_numeric($c)) {
  2101.                         return PHPExcel_Calculation_Functions::VALUE();
  2102.                     }
  2103.                 }
  2104.             }
  2105.             $result array_shift($testResult);
  2106.         }
  2107.  
  2108.         if (is_null($result)) {
  2109.             return 0;
  2110.         elseif((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) {
  2111.             return PHPExcel_Calculation_Functions::NaN();
  2112.         }
  2113.         return $result;
  2114.     }    //    function calculateCellValue(
  2115.  
  2116.  
  2117.     /**
  2118.      *    Validate and parse a formula string
  2119.      *
  2120.      *    @param    string        $formula        Formula to parse
  2121.      *    @return    array 
  2122.      *    @throws    Exception
  2123.      */
  2124.     public function parseFormula($formula{
  2125.         //    Basic validation that this is indeed a formula
  2126.         //    We return an empty array if not
  2127.         $formula trim($formula);
  2128.         if ((strlen($formula== 0|| ($formula{0!= '=')) return array();
  2129.         $formula trim(substr($formula,1));
  2130.         $formulaLength strlen($formula);
  2131.         if ($formulaLength 1return array();
  2132.  
  2133.         //    Parse the formula and return the token stack
  2134.         return $this->_parseFormula($formula);
  2135.     }    //    function parseFormula()
  2136.  
  2137.  
  2138.     /**
  2139.      *    Calculate the value of a formula
  2140.      *
  2141.      *    @param    string        $formula        Formula to parse
  2142.      *    @return    mixed 
  2143.      *    @throws    Exception
  2144.      */
  2145.     public function calculateFormula($formula$cellID=nullPHPExcel_Cell $pCell null{
  2146.         //    Initialise the logging settings
  2147.         $this->formulaError = null;
  2148.         $this->debugLog = $this->debugLogStack array();
  2149.  
  2150.         //    Disable calculation cacheing because it only applies to cell calculations, not straight formulae
  2151.         //    But don't actually flush any cache
  2152.         $resetCache $this->getCalculationCacheEnabled();
  2153.         self::$_calculationCacheEnabled false;
  2154.         //    Execute the calculation
  2155.         try {
  2156.             $result self::_unwrapResult($this->_calculateFormulaValue($formula$cellID$pCell));
  2157.         catch (Exception $e{
  2158.             throw(new Exception($e->getMessage()));
  2159.         }
  2160.  
  2161.         //    Reset calculation cacheing to its previous state
  2162.         self::$_calculationCacheEnabled $resetCache;
  2163.  
  2164.         return $result;
  2165.     }    //    function calculateFormula()
  2166.  
  2167.  
  2168.     /**
  2169.      *    Parse a cell formula and calculate its value
  2170.      *
  2171.      *    @param    string            $formula    The formula to parse and calculate
  2172.      *    @param    string            $cellID        The ID (e.g. A3) of the cell that we are calculating
  2173.      *    @param    PHPExcel_Cell    $pCell        Cell to calculate
  2174.      *    @return    mixed 
  2175.      *    @throws    Exception
  2176.      */
  2177.     public function _calculateFormulaValue($formula$cellID=nullPHPExcel_Cell $pCell null{
  2178. //        echo '<b>'.$cellID.'</b><br />';
  2179.         $cellValue '';
  2180.  
  2181.         //    Basic validation that this is indeed a formula
  2182.         //    We simply return the "cell value" (formula) if not
  2183.         $formula trim($formula);
  2184.         if ($formula{0!= '='return self::_wrapResult($formula);
  2185.         $formula trim(substr($formula,1));
  2186.         $formulaLength strlen($formula);
  2187.         if ($formulaLength 1return self::_wrapResult($formula);
  2188.  
  2189.         $wsTitle 'Wrk';
  2190.         if (!is_null($pCell)) {
  2191.             $pCellParent $pCell->getParent();
  2192.             if (!is_null($pCellParent)) {
  2193.                 $wsTitle $pCellParent->getTitle();
  2194.             }
  2195.         }
  2196.         // Is calculation cacheing enabled?
  2197.         if (!is_null($cellID)) {
  2198.             if (self::$_calculationCacheEnabled{
  2199.                 // Is the value present in calculation cache?
  2200. //                echo 'Testing cache value<br />';
  2201.                 if (isset(self::$_calculationCache[$wsTitle][$cellID])) {
  2202. //                    echo 'Value is in cache<br />';
  2203.                     $this->_writeDebug('Testing cache value for cell '.$cellID);
  2204.                     //    Is cache still valid?
  2205.                     if ((time(microtime(true)) self::$_calculationCache[$wsTitle][$cellID]['time'self::$_calculationCacheExpirationTime{
  2206. //                        echo 'Cache time is still valid<br />';
  2207.                         $this->_writeDebug('Retrieving value for '.$cellID.' from cache');
  2208.                         // Return the cached result
  2209.                         $returnValue self::$_calculationCache[$wsTitle][$cellID]['data'];
  2210. //                        echo 'Retrieving data value of '.$returnValue.' for '.$cellID.' from cache<br />';
  2211.                         if (is_array($returnValue)) {
  2212.                             $returnValue PHPExcel_Calculation_Functions::flattenArray($returnValue);
  2213.                             return array_shift($returnValue);
  2214.                         }
  2215.                         return $returnValue;
  2216.                     else {
  2217. //                        echo 'Cache has expired<br />';
  2218.                         $this->_writeDebug('Cache value for '.$cellID.' has expired');
  2219.                         //    Clear the cache if it's no longer valid
  2220.                         unset(self::$_calculationCache[$wsTitle][$cellID]);
  2221.                     }
  2222.                 }
  2223.             }
  2224.         }
  2225.  
  2226.         if ((in_array($wsTitle.'!'.$cellID,$this->debugLogStack)) && ($wsTitle != 'Wrk')) {
  2227.             if ($this->cyclicFormulaCount <= 0{
  2228.                 return $this->_raiseFormulaError('Cyclic Reference in Formula');
  2229.             elseif (($this->_cyclicFormulaCount >= $this->cyclicFormulaCount&&
  2230.                       ($this->_cyclicFormulaCell == $wsTitle.'!'.$cellID)) {
  2231.                 return $cellValue;
  2232.             elseif ($this->_cyclicFormulaCell == $wsTitle.'!'.$cellID{
  2233.                 $this->_cyclicFormulaCount++;
  2234.                 if ($this->_cyclicFormulaCount >= $this->cyclicFormulaCount{
  2235.                     return $cellValue;
  2236.                 }
  2237.             elseif ($this->_cyclicFormulaCell == ''{
  2238.                 $this->_cyclicFormulaCell $wsTitle.'!'.$cellID;
  2239.                 if ($this->_cyclicFormulaCount >= $this->cyclicFormulaCount{
  2240.                     return $cellValue;
  2241.                 }
  2242.             }
  2243.         }
  2244.         $this->debugLogStack[$wsTitle.'!'.$cellID;
  2245.         //    Parse the formula onto the token stack and calculate the value
  2246.         $cellValue $this->_processTokenStack($this->_parseFormula($formula)$cellID$pCell);
  2247.         array_pop($this->debugLogStack);
  2248.  
  2249.         // Save to calculation cache
  2250.         if (!is_null($cellID)) {
  2251.             if (self::$_calculationCacheEnabled{
  2252.                 self::$_calculationCache[$wsTitle][$cellID]['time'(time(microtime(true));
  2253.                 self::$_calculationCache[$wsTitle][$cellID]['data'$cellValue;
  2254.             }
  2255.         }
  2256.  
  2257.         //    Return the calculated value
  2258.         return $cellValue;
  2259.     }    //    function _calculateFormulaValue()
  2260.  
  2261.  
  2262.     /**
  2263.      *    Ensure that paired matrix operands are both matrices and of the same size
  2264.      *
  2265.      *    @param    mixed        &$operand1    First matrix operand
  2266.      *    @param    mixed        &$operand2    Second matrix operand
  2267.      *    @param    integer        $resize        Flag indicating whether the matrices should be resized to match
  2268.      *                                         and (if so), whether the smaller dimension should grow or the
  2269.      *                                         larger should shrink.
  2270.      *                                             0 = no resize
  2271.      *                                             1 = shrink to fit
  2272.      *                                             2 = extend to fit
  2273.      */
  2274.     private static function _checkMatrixOperands(&$operand1,&$operand2,$resize 1{
  2275.         //    Examine each of the two operands, and turn them into an array if they aren't one already
  2276.         //    Note that this function should only be called if one or both of the operand is already an array
  2277.         if (!is_array($operand1)) {
  2278.             list($matrixRows,$matrixColumnsself::_getMatrixDimensions($operand2);
  2279.             $operand1 array_fill(0,$matrixRows,array_fill(0,$matrixColumns,$operand1));
  2280.             $resize 0;
  2281.         elseif (!is_array($operand2)) {
  2282.             list($matrixRows,$matrixColumnsself::_getMatrixDimensions($operand1);
  2283.             $operand2 array_fill(0,$matrixRows,array_fill(0,$matrixColumns,$operand2));
  2284.             $resize 0;
  2285.         }
  2286.  
  2287.         list($matrix1Rows,$matrix1Columnsself::_getMatrixDimensions($operand1);
  2288.         list($matrix2Rows,$matrix2Columnsself::_getMatrixDimensions($operand2);
  2289.         if (($matrix1Rows == $matrix2Columns&& ($matrix2Rows == $matrix1Columns)) {
  2290.             $resize 1;
  2291.         }
  2292.  
  2293.         if ($resize == 2{
  2294.             //    Given two matrices of (potentially) unequal size, convert the smaller in each dimension to match the larger
  2295.             self::_resizeMatricesExtend($operand1,$operand2);
  2296.         elseif ($resize == 1{
  2297.             //    Given two matrices of (potentially) unequal size, convert the larger in each dimension to match the smaller
  2298.             self::_resizeMatricesShrink($operand1,$operand2);
  2299.         }
  2300.     }    //    function _checkMatrixOperands()
  2301.  
  2302.  
  2303.     /**
  2304.      *    Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0
  2305.      *
  2306.      *    @param    mixed        &$matrix        matrix operand
  2307.      *    @return    array        An array comprising the number of rows, and number of columns
  2308.      */
  2309.     public static function _getMatrixDimensions(&$matrix{
  2310.         $matrixRows count($matrix);
  2311.         $matrixColumns 0;
  2312.         foreach($matrix as $rowKey => $rowValue{
  2313.             $colCount count($rowValue);
  2314.             if ($colCount $matrixColumns{
  2315.                 $matrixColumns $colCount;
  2316.             }
  2317.             if (!is_array($rowValue)) {
  2318.                 $matrix[$rowKeyarray($rowValue);
  2319.             else {
  2320.                 $matrix[$rowKeyarray_values($rowValue);
  2321.             }
  2322.         }
  2323.         $matrix array_values($matrix);
  2324.         return array($matrixRows,$matrixColumns);
  2325.     }    //    function _getMatrixDimensions()
  2326.  
  2327.  
  2328.     /**
  2329.      *    Ensure that paired matrix operands are both matrices of the same size
  2330.      *
  2331.      *    @param    mixed        &$matrix1    First matrix operand
  2332.      *    @param    mixed        &$matrix2    Second matrix operand
  2333.      */
  2334.     private static function _resizeMatricesShrink(&$matrix1,&$matrix2{
  2335.         list($matrix1Rows,$matrix1Columnsself::_getMatrixDimensions($matrix1);
  2336.         list($matrix2Rows,$matrix2Columnsself::_getMatrixDimensions($matrix2);
  2337.  
  2338.         if (($matrix2Columns $matrix1Columns|| ($matrix2Rows $matrix1Rows)) {
  2339.             if ($matrix2Columns $matrix1Columns{
  2340.                 for ($i 0$i $matrix1Rows++$i{
  2341.                     for ($j $matrix2Columns$j $matrix1Columns++$j{
  2342.                         unset($matrix1[$i][$j]);
  2343.                     }
  2344.                 }
  2345.             }
  2346.             if ($matrix2Rows $matrix1Rows{
  2347.                 for ($i $matrix2Rows$i $matrix1Rows++$i{
  2348.                     unset($matrix1[$i]);
  2349.                 }
  2350.             }
  2351.         }
  2352.  
  2353.         if (($matrix1Columns $matrix2Columns|| ($matrix1Rows $matrix2Rows)) {
  2354.             if ($matrix1Columns $matrix2Columns{
  2355.                 for ($i 0$i $matrix2Rows++$i{
  2356.                     for ($j $matrix1Columns$j $matrix2Columns++$j{
  2357.                         unset($matrix2[$i][$j]);
  2358.                     }
  2359.                 }
  2360.             }
  2361.             if ($matrix1Rows $matrix2Rows{
  2362.                 for ($i $matrix1Rows$i $matrix2Rows++$i{
  2363.                     unset($matrix2[$i]);
  2364.                 }
  2365.             }
  2366.         }
  2367.     }    //    function _resizeMatricesShrink()
  2368.  
  2369.  
  2370.     /**
  2371.      *    Ensure that paired matrix operands are both matrices of the same size
  2372.      *
  2373.      *    @param    mixed        &$matrix1    First matrix operand
  2374.      *    @param    mixed        &$matrix2    Second matrix operand
  2375.      */
  2376.     private static function _resizeMatricesExtend(&$matrix1,&$matrix2{
  2377.         list($matrix1Rows,$matrix1Columnsself::_getMatrixDimensions($matrix1);
  2378.         list($matrix2Rows,$matrix2Columnsself::_getMatrixDimensions($matrix2);
  2379.  
  2380.         if (($matrix2Columns $matrix1Columns|| ($matrix2Rows $matrix1Rows)) {
  2381.             if ($matrix2Columns $matrix1Columns{
  2382.                 for ($i 0$i $matrix2Rows++$i{
  2383.                     $x $matrix2[$i][$matrix2Columns-1];
  2384.                     for ($j $matrix2Columns$j $matrix1Columns++$j{
  2385.                         $matrix2[$i][$j$x;
  2386.                     }
  2387.                 }
  2388.             }
  2389.             if ($matrix2Rows $matrix1Rows{
  2390.                 $x $matrix2[$matrix2Rows-1];
  2391.                 for ($i 0$i $matrix1Rows++$i{
  2392.                     $matrix2[$i$x;
  2393.                 }
  2394.             }
  2395.         }
  2396.  
  2397.         if (($matrix1Columns $matrix2Columns|| ($matrix1Rows $matrix2Rows)) {
  2398.             if ($matrix1Columns $matrix2Columns{
  2399.                 for ($i 0$i $matrix1Rows++$i{
  2400.                     $x $matrix1[$i][$matrix1Columns-1];
  2401.                     for ($j $matrix1Columns$j $matrix2Columns++$j{
  2402.                         $matrix1[$i][$j$x;
  2403.                     }
  2404.                 }
  2405.             }
  2406.             if ($matrix1Rows $matrix2Rows{
  2407.                 $x $matrix1[$matrix1Rows-1];
  2408.                 for ($i 0$i $matrix2Rows++$i{
  2409.                     $matrix1[$i$x;
  2410.                 }
  2411.             }
  2412.         }
  2413.     }    //    function _resizeMatricesExtend()
  2414.  
  2415.  
  2416.     /**
  2417.      *    Format details of an operand for display in the log (based on operand type)
  2418.      *
  2419.      *    @param    mixed        $value    First matrix operand
  2420.      *    @return    mixed 
  2421.      */
  2422.     private static function _showValue($value{
  2423.         $testArray PHPExcel_Calculation_Functions::flattenArray($value);
  2424.         if (count($testArray== 1{
  2425.             $value array_pop($testArray);
  2426.         }
  2427.  
  2428.         if (is_array($value)) {
  2429.             $returnMatrix array();
  2430.             $pad $rpad ', ';
  2431.             foreach($value as $row{
  2432.                 if (is_array($row)) {
  2433.                     $returnMatrix[implode($pad,$row);
  2434.                     $rpad '; ';
  2435.                 else {
  2436.                     $returnMatrix[$row;
  2437.                 }
  2438.             }
  2439.             return '{ '.implode($rpad,$returnMatrix).' }';
  2440.         elseif(is_bool($value)) {
  2441.             return ($valueself::$_localeBoolean['TRUE'self::$_localeBoolean['FALSE'];
  2442.         }
  2443.  
  2444.         return $value;
  2445.     }    //    function _showValue()
  2446.  
  2447.  
  2448.     /**
  2449.      *    Format type and details of an operand for display in the log (based on operand type)
  2450.      *
  2451.      *    @param    mixed        $value    First matrix operand
  2452.      *    @return    mixed 
  2453.      */
  2454.     private static function _showTypeDetails($value{
  2455.         $testArray PHPExcel_Calculation_Functions::flattenArray($value);
  2456.         if (count($testArray== 1{
  2457.             $value array_pop($testArray);
  2458.         }
  2459.  
  2460.         switch (gettype($value)) {
  2461.             case 'double'    :
  2462.             case 'float'    :
  2463.                 $typeString 'a floating point number';
  2464.                 break;
  2465.             case 'integer'    :
  2466.                 $typeString 'an integer number';
  2467.                 break;
  2468.             case 'boolean'    :
  2469.                 $typeString 'a boolean';
  2470.                 break;
  2471.             case 'array'    :
  2472.                 $typeString 'a matrix';
  2473.                 break;
  2474.             case 'string'    :
  2475.                 if ($value == ''{
  2476.                     return 'an empty string';
  2477.                 elseif ($value{0== '#'{
  2478.                     return 'a '.$value.' error';
  2479.                 else {
  2480.                     $typeString 'a string';
  2481.                 }
  2482.                 break;
  2483.             case 'NULL'    :
  2484.                 return 'a null value';
  2485.         }
  2486.         return $typeString.' with a value of '.self::_showValue($value);
  2487.     }    //    function _showTypeDetails()
  2488.  
  2489.  
  2490.     private static function _convertMatrixReferences($formula{
  2491.         static $matrixReplaceFrom array('{',';','}');
  2492.         static $matrixReplaceTo array('MKMATRIX(MKMATRIX(','),MKMATRIX(','))');
  2493.  
  2494.         //    Convert any Excel matrix references to the MKMATRIX() function
  2495.         if (strpos($formula,'{'!== false{
  2496.             //    If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators
  2497.             if (strpos($formula,'"'!== false{
  2498.                 //    So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded
  2499.                 //        the formula
  2500.                 $temp explode('"',$formula);
  2501.                 //    Open and Closed counts used for trapping mismatched braces in the formula
  2502.                 $openCount $closeCount 0;
  2503.                 foreach($temp as $i => &$value{
  2504.                     //    Only count/replace in alternate array entries
  2505.                     if (($i 2== 0{
  2506.                         $openCount += substr_count($value,'{');
  2507.                         $closeCount += substr_count($value,'}');
  2508.                         $value str_replace($matrixReplaceFrom,$matrixReplaceTo,$value);
  2509.                     }
  2510.                 }
  2511.                 unset($value);
  2512.                 //    Then rebuild the formula string
  2513.                 $formula implode('"',$temp);
  2514.             else {
  2515.                 //    If there's no quoted strings, then we do a simple count/replace
  2516.                 $openCount substr_count($formula,'{');
  2517.                 $closeCount substr_count($formula,'}');
  2518.                 $formula str_replace($matrixReplaceFrom,$matrixReplaceTo,$formula);
  2519.             }
  2520.             //    Trap for mismatched braces and trigger an appropriate error
  2521.             if ($openCount $closeCount{
  2522.                 if ($openCount 0{
  2523.                     return $this->_raiseFormulaError("Formula Error: Mismatched matrix braces '}'");
  2524.                 else {
  2525.                     return $this->_raiseFormulaError("Formula Error: Unexpected '}' encountered");
  2526.                 }
  2527.             elseif ($openCount $closeCount{
  2528.                 if ($closeCount 0{
  2529.                     return $this->_raiseFormulaError("Formula Error: Mismatched matrix braces '{'");
  2530.                 else {
  2531.                     return $this->_raiseFormulaError("Formula Error: Unexpected '{' encountered");
  2532.                 }
  2533.             }
  2534.         }
  2535.  
  2536.         return $formula;
  2537.     }    //    function _convertMatrixReferences()
  2538.  
  2539.  
  2540.     private static function _mkMatrix({
  2541.         return func_get_args();
  2542.     }    //    function _mkMatrix()
  2543.  
  2544.  
  2545.     // Convert infix to postfix notation
  2546.     private function _parseFormula($formula{
  2547.         if (($formula self::_convertMatrixReferences(trim($formula))) === false{
  2548.             return false;
  2549.         }
  2550.  
  2551.         //    Binary Operators
  2552.         //    These operators always work on two values
  2553.         //    Array key is the operator, the value indicates whether this is a left or right associative operator
  2554.         $operatorAssociativity    array('^' => 0,                                                            //    Exponentiation
  2555.                                         '*' => 0'/' => 0,                                                 //    Multiplication and Division
  2556.                                         '+' => 0'-' => 0,                                                    //    Addition and Subtraction
  2557.                                         '&' => 0,                                                            //    Concatenation
  2558.                                         '|' => 0':' => 0,                                                    //    Intersect and Range
  2559.                                         '>' => 0'<' => 0'=' => 0'>=' => 0'<=' => 0'<>' => 0        //    Comparison
  2560.                                        );
  2561.         //    Comparison (Boolean) Operators
  2562.         //    These operators work on two values, but always return a boolean result
  2563.         $comparisonOperators    array('>''<''=''>=''<=''<>');
  2564.  
  2565.         //    Operator Precedence
  2566.         //    This list includes all valid operators, whether binary (including boolean) or unary (such as %)
  2567.         //    Array key is the operator, the value is its precedence
  2568.         $operatorPrecedence    array(':' => 8,                                                                //    Range
  2569.                                     '|' => 7,                                                                //    Intersect
  2570.                                     '~' => 6,                                                                //    Negation
  2571.                                     '%' => 5,                                                                //    Percentage
  2572.                                     '^' => 4,                                                                //    Exponentiation
  2573.                                     '*' => 3'/' => 3,                                                     //    Multiplication and Division
  2574.                                     '+' => 2'-' => 2,                                                        //    Addition and Subtraction
  2575.                                     '&' => 1,                                                                //    Concatenation
  2576.                                     '>' => 0'<' => 0'=' => 0'>=' => 0'<=' => 0'<>' => 0            //    Comparison
  2577.                                    );
  2578.  
  2579.         $regexpMatchString '/^('.self::CALCULATION_REGEXP_FUNCTION.
  2580.                                '|'.self::CALCULATION_REGEXP_NUMBER.
  2581.                                '|'.self::CALCULATION_REGEXP_STRING.
  2582.                                '|'.self::CALCULATION_REGEXP_OPENBRACE.
  2583.                                '|'.self::CALCULATION_REGEXP_CELLREF.
  2584.                                '|'.self::CALCULATION_REGEXP_NAMEDRANGE.
  2585.                                '|'.self::CALCULATION_REGEXP_ERROR.
  2586.                              ')/si';
  2587.  
  2588.         //    Start with initialisation
  2589.         $index 0;
  2590.         $stack new PHPExcel_Token_Stack;
  2591.         $output array();
  2592.         $expectingOperator false;                    //    We use this test in syntax-checking the expression to determine when a
  2593.                                                     //        - is a negation or + is a positive operator rather than an operation
  2594.         $expectingOperand false;                    //    We use this test in syntax-checking the expression to determine whether an operand
  2595.                                                     //        should be null in a function call
  2596.         //    The guts of the lexical parser
  2597.         //    Loop through the formula extracting each operator and operand in turn
  2598.         while(True{
  2599. //            echo 'Assessing Expression <b>'.substr($formula, $index).'</b><br />';
  2600.             $opCharacter $formula{$index};    //    Get the first character of the value at the current index position
  2601. //            echo 'Initial character of expression block is '.$opCharacter.'<br />';
  2602.             if ((in_array($opCharacter$comparisonOperators)) && (strlen($formula$index&& (in_array($formula{$index+1}$comparisonOperators))) {
  2603.                 $opCharacter .= $formula{++$index};
  2604. //                echo 'Initial character of expression block is comparison operator '.$opCharacter.'<br />';
  2605.             }
  2606.  
  2607.             //    Find out if we're currently at the beginning of a number, variable, cell reference, function, parenthesis or operand
  2608.             $isOperandOrFunction preg_match($regexpMatchStringsubstr($formula$index)$match);
  2609. //            echo '$isOperandOrFunction is '.(($isOperandOrFunction)?'True':'False').'<br />';
  2610.  
  2611.             if ($opCharacter == '-' && !$expectingOperator{                //    Is it a negation instead of a minus?
  2612. //                echo 'Element is a Negation operator<br />';
  2613.                 $stack->push('Unary Operator','~');                            //    Put a negation on the stack
  2614.                 ++$index;                                                    //        and drop the negation symbol
  2615.             elseif ($opCharacter == '%' && $expectingOperator{
  2616. //                echo 'Element is a Percentage operator<br />';
  2617.                 $stack->push('Unary Operator','%');                            //    Put a percentage on the stack
  2618.                 ++$index;
  2619.             elseif ($opCharacter == '+' && !$expectingOperator{            //    Positive (rather than plus) can be discarded?
  2620. //                echo 'Element is a Positive number, not Plus operator<br />';
  2621.                 ++$index;                                                    //    Drop the redundant plus symbol
  2622.             elseif (($opCharacter == '~'&& (!$isOperandOrFunction)) {                    //    We have to explicitly deny a tilde, because it's legal
  2623.                 return $this->_raiseFormulaError("Formula Error: Illegal character '~'");    //        on the stack but not in the input expression
  2624.  
  2625.             elseif ((in_array($opCharacterself::$_operatorsor $isOperandOrFunction&& $expectingOperator{    //    Are we putting an operator on the stack?
  2626. //                echo 'Element with value '.$opCharacter.' is an Operator<br />';
  2627.                 while($stack->count(&&
  2628.                     ($o2 $stack->last()) &&
  2629.                     in_array($o2['value']self::$_operators&&
  2630.                     @($operatorAssociativity[$opCharacter$operatorPrecedence[$opCharacter$operatorPrecedence[$o2['value']] $operatorPrecedence[$opCharacter<= $operatorPrecedence[$o2['value']])) {
  2631.                     $output[$stack->pop();                                //    Swap operands and higher precedence operators from the stack to the output
  2632.                 }
  2633.                 $stack->push('Binary Operator',$opCharacter);    //    Finally put our current operator onto the stack
  2634.                 ++$index;
  2635.                 $expectingOperator false;
  2636.  
  2637.             elseif ($opCharacter == ')' && $expectingOperator{            //    Are we expecting to close a parenthesis?
  2638. //                echo 'Element is a Closing bracket<br />';
  2639.                 $expectingOperand false;
  2640.                 while (($o2 $stack->pop()) && $o2['value'!= '('{        //    Pop off the stack back to the last (
  2641.                     if (is_null($o2)) return $this->_raiseFormulaError('Formula Error: Unexpected closing brace ")"');
  2642.                     else $output[$o2;
  2643.                 }
  2644.                 $d $stack->last(2);
  2645.                 if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i'$d['value']$matches)) {    //    Did this parenthesis just close a function?
  2646.                     $functionName $matches[1];                                        //    Get the function name
  2647. //                    echo 'Closed Function is '.$functionName.'<br />';
  2648.                     $d $stack->pop();
  2649.                     $argumentCount $d['value'];        //    See how many arguments there were (argument count is the next value stored on the stack)
  2650. //                    if ($argumentCount == 0) {
  2651. //                        echo 'With no arguments<br />';
  2652. //                    } elseif ($argumentCount == 1) {
  2653. //                        echo 'With 1 argument<br />';
  2654. //                    } else {
  2655. //                        echo 'With '.$argumentCount.' arguments<br />';
  2656. //                    }
  2657.                     $output[$d;                        //    Dump the argument count on the output
  2658.                     $output[$stack->pop();            //    Pop the function and push onto the output
  2659.                     if (array_key_exists($functionNameself::$_controlFunctions)) {
  2660. //                        echo 'Built-in function '.$functionName.'<br />';
  2661.                         $expectedArgumentCount self::$_controlFunctions[$functionName]['argumentCount'];
  2662.                         $functionCall self::$_controlFunctions[$functionName]['functionCall'];
  2663.                     elseif (array_key_exists($functionNameself::$_PHPExcelFunctions)) {
  2664. //                        echo 'PHPExcel function '.$functionName.'<br />';
  2665.                         $expectedArgumentCount self::$_PHPExcelFunctions[$functionName]['argumentCount'];
  2666.                         $functionCall self::$_PHPExcelFunctions[$functionName]['functionCall'];
  2667.                     else {    // did we somehow push a non-function on the stack? this should never happen
  2668.                         return $this->_raiseFormulaError("Formula Error: Internal error, non-function on stack");
  2669.                     }
  2670.                     //    Check the argument count
  2671.                     $argumentCountError False;
  2672.                     if (is_numeric($expectedArgumentCount)) {
  2673.                         if ($expectedArgumentCount 0{
  2674. //                            echo '$expectedArgumentCount is between 0 and '.abs($expectedArgumentCount).'<br />';
  2675.                             if ($argumentCount abs($expectedArgumentCount)) {
  2676.                                 $argumentCountError True;
  2677.                                 $expectedArgumentCountString 'no more than '.abs($expectedArgumentCount);
  2678.                             }
  2679.                         else {
  2680. //                            echo '$expectedArgumentCount is numeric '.$expectedArgumentCount.'<br />';
  2681.                             if ($argumentCount != $expectedArgumentCount{
  2682.                                 $argumentCountError True;
  2683.                                 $expectedArgumentCountString $expectedArgumentCount;
  2684.                             }
  2685.                         }
  2686.                     elseif ($expectedArgumentCount != '*'{
  2687.                         $isOperandOrFunction preg_match('/(\d*)([-+,])(\d*)/',$expectedArgumentCount,$argMatch);
  2688. //                        print_r($argMatch);
  2689. //                        echo '<br />';
  2690.                         switch ($argMatch[2]{
  2691.                             case '+' :
  2692.                                 if ($argumentCount $argMatch[1]{
  2693.                                     $argumentCountError True;
  2694.                                     $expectedArgumentCountString $argMatch[1].' or more ';
  2695.                                 }
  2696.                                 break;
  2697.                             case '-' :
  2698.                                 if (($argumentCount $argMatch[1]|| ($argumentCount $argMatch[3])) {
  2699.                                     $argumentCountError True;
  2700.                                     $expectedArgumentCountString 'between '.$argMatch[1].' and '.$argMatch[3];
  2701.                                 }
  2702.                                 break;
  2703.                             case ',' :
  2704.                                 if (($argumentCount != $argMatch[1]&& ($argumentCount != $argMatch[3])) {
  2705.                                     $argumentCountError True;
  2706.                                     $expectedArgumentCountString 'either '.$argMatch[1].' or '.$argMatch[3];
  2707.                                 }
  2708.                                 break;
  2709.                         }
  2710.                     }
  2711.                     if ($argumentCountError{
  2712.                         return $this->_raiseFormulaError("Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, ".$expectedArgumentCountString." expected");
  2713.                     }
  2714.                 }
  2715.                 ++$index;
  2716.  
  2717.             elseif ($opCharacter == ','{            //    Is this the separator for function arguments?
  2718. //                echo 'Element is a Function argument separator<br />';
  2719.                 while (($o2 $stack->pop()) && $o2['value'!= '('{        //    Pop off the stack back to the last (
  2720.                     if (is_null($o2)) return $this->_raiseFormulaError("Formula Error: Unexpected ,");
  2721.                     else $output[$o2;    // pop the argument expression stuff and push onto the output
  2722.                 }
  2723.                 //    If we've a comma when we're expecting an operand, then what we actually have is a null operand;
  2724.                 //        so push a null onto the stack
  2725.                 if (($expectingOperand|| (!$expectingOperator)) {
  2726.                     $output[array('type' => 'NULL Value''value' => self::$_ExcelConstants['NULL']'reference' => NULL);
  2727.                 }
  2728.                 // make sure there was a function
  2729.                 $d $stack->last(2);
  2730.                 if (!preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i'$d['value']$matches))
  2731.                     return $this->_raiseFormulaError("Formula Error: Unexpected ,");
  2732.                 $d $stack->pop();
  2733.                 $stack->push($d['type'],++$d['value'],$d['reference']);    // increment the argument count
  2734.                 $stack->push('Brace''(');    // put the ( back on, we'll need to pop back to it again
  2735.                 $expectingOperator false;
  2736.                 $expectingOperand true;
  2737.                 ++$index;
  2738.  
  2739.             elseif ($opCharacter == '(' && !$expectingOperator{
  2740. //                echo 'Element is an Opening Bracket<br />';
  2741.                 $stack->push('Brace''(');
  2742.                 ++$index;
  2743.  
  2744.             elseif ($isOperandOrFunction && !$expectingOperator{    // do we now have a function/variable/number?
  2745.                 $expectingOperator true;
  2746.                 $expectingOperand false;
  2747.                 $val $match[1];
  2748.                 $length strlen($val);
  2749. //                echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function<br />';
  2750.  
  2751.                 if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i'$val$matches)) {
  2752.                     $val preg_replace('/\s/','',$val);
  2753. //                    echo 'Element '.$val.' is a Function<br />';
  2754.                     if (array_key_exists(strtoupper($matches[1])self::$_PHPExcelFunctions|| array_key_exists(strtoupper($matches[1])self::$_controlFunctions)) {    // it's a func
  2755.                         $stack->push('Function'strtoupper($val));
  2756.                         $ax preg_match('/^\s*(\s*\))/i'substr($formula$index+$length)$amatch);
  2757.                         if ($ax{
  2758.                             $stack->push('Operand Count for Function '.self::_localeFunc(strtoupper($val)).')'0);
  2759.                             $expectingOperator true;
  2760.                         else {
  2761.                             $stack->push('Operand Count for Function '.self::_localeFunc(strtoupper($val)).')'1);
  2762.                             $expectingOperator false;
  2763.                         }
  2764.                         $stack->push('Brace''(');
  2765.                     else {    // it's a var w/ implicit multiplication
  2766.                         $output[array('type' => 'Value''value' => $matches[1]'reference' => NULL);
  2767.                     }
  2768.                 elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i'$val$matches)) {
  2769. //                    echo 'Element '.$val.' is a Cell reference<br />';
  2770. //                    Watch for this case-change when modifying to allow cell references in different worksheets...
  2771. //                        Should only be applied to the actual cell column, not the worksheet name
  2772.                     $cellRef strtoupper($val);
  2773. //                    $output[] = $cellRef;
  2774.                     $output[array('type' => 'Cell Reference''value' => $val'reference' => $cellRef);
  2775. //                    $expectingOperator = false;
  2776.                 else {    // it's a variable, constant, string, number or boolean
  2777. //                    echo 'Element is a Variable, Constant, String, Number or Boolean<br />';
  2778.                     $localeConstant false;
  2779.                     if ($opCharacter == '"'{
  2780. //                        echo 'Element is a String<br />';
  2781.                         //    UnEscape any quotes within the string
  2782.                         $val self::_wrapResult(str_replace('""','"',self::_unwrapResult($val)));
  2783.                     elseif (is_numeric($val)) {
  2784. //                        echo 'Element is a Number<br />';
  2785.                         if ((strpos($val,'.'!== False|| (stripos($val,'e'!== False|| ($val PHP_INT_MAX|| ($val < -PHP_INT_MAX)) {
  2786. //                            echo 'Casting '.$val.' to float<br />';
  2787.                             $val = (float) $val;
  2788.                         else {
  2789. //                            echo 'Casting '.$val.' to integer<br />';
  2790.                             $val = (integer) $val;
  2791.                         }
  2792.                     elseif (array_key_exists(trim(strtoupper($val))self::$_ExcelConstants)) {
  2793.                         $excelConstant trim(strtoupper($val));
  2794. //                        echo 'Element '.$excelConstant.' is an Excel Constant<br />';
  2795.                         $val self::$_ExcelConstants[$excelConstant];
  2796.                     elseif (($localeConstant array_search(trim(strtoupper($val))self::$_localeBoolean)) !== false{
  2797. //                        echo 'Element '.$localeConstant.' is an Excel Constant<br />';
  2798.                         $val self::$_ExcelConstants[$localeConstant];
  2799.                     }
  2800.                     $details array('type' => 'Value''value' => $val'reference' => NULL);
  2801.                     if ($localeConstant$details['localeValue'$localeConstant}
  2802.                     $output[$details;
  2803.                 }
  2804.                 $index += $length;
  2805.  
  2806.             elseif ($opCharacter == ')'{    // miscellaneous error checking
  2807.                 if ($expectingOperand{
  2808.                     $output[array('type' => 'Null Value''value' => self::$_ExcelConstants['NULL']'reference' => NULL);
  2809.                     $expectingOperand false;
  2810.                     $expectingOperator True;
  2811.                 else {
  2812.                     return $this->_raiseFormulaError("Formula Error: Unexpected ')'");
  2813.                 }
  2814.             elseif (in_array($opCharacterself::$_operators&& !$expectingOperator{
  2815.                 return $this->_raiseFormulaError("Formula Error: Unexpected operator '$opCharacter'");
  2816.             else {    // I don't even want to know what you did to get here
  2817.                 return $this->_raiseFormulaError("Formula Error: An unexpected error occured");
  2818.             }
  2819.             //    Test for end of formula string
  2820.             if ($index == strlen($formula)) {
  2821.                 //    Did we end with an operator?.
  2822.                 //    Only valid for the % unary operator
  2823.                 if ((in_array($opCharacterself::$_operators)) && ($opCharacter != '%')) {
  2824.                     return $this->_raiseFormulaError("Formula Error: Operator '$opCharacter' has no operands");
  2825.                 else {
  2826.                     break;
  2827.                 }
  2828.             }
  2829.             //    Ignore white space
  2830.             while (($formula{$index== "\n"|| ($formula{$index== "\r")) {
  2831.                 ++$index;
  2832.             }
  2833.             if ($formula{$index== ' '{
  2834.                 while ($formula{$index== ' '{
  2835.                     ++$index;
  2836.                 }
  2837.                 //    If we're expecting an operator, but only have a space between the previous and next operands (and both are
  2838.                 //        Cell References) then we have an INTERSECTION operator
  2839. //                echo 'Possible Intersect Operator<br />';
  2840.                 if (($expectingOperator&& (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'.*/i'substr($formula$index)$match)) &&
  2841.                     ($output[count($output)-1]['type'== 'Cell Reference')) {
  2842. //                    echo 'Element is an Intersect Operator<br />';
  2843.                     while($stack->count(&&
  2844.                         ($o2 $stack->last()) &&
  2845.                         in_array($o2['value']self::$_operators&&
  2846.                         @($operatorAssociativity[$opCharacter$operatorPrecedence[$opCharacter$operatorPrecedence[$o2['value']] $operatorPrecedence[$opCharacter<= $operatorPrecedence[$o2['value']])) {
  2847.                         $output[$stack->pop();                                //    Swap operands and higher precedence operators from the stack to the output
  2848.                     }
  2849.                     $stack->push('Binary Operator','|');    //    Put an Intersect Operator on the stack
  2850.                     $expectingOperator false;
  2851.                 }
  2852.             }
  2853.         }
  2854.  
  2855.         while (!is_null($op $stack->pop())) {    // pop everything off the stack and push onto output
  2856.             if ($opCharacter['value'== '('return $this->_raiseFormulaError("Formula Error: Expecting ')'");    // if there are any opening braces on the stack, then braces were unbalanced
  2857.             $output[$op;
  2858.         }
  2859.         return $output;
  2860.     }    //    function _parseFormula()
  2861.  
  2862.  
  2863.     // evaluate postfix notation
  2864.     private function _processTokenStack($tokens$cellID nullPHPExcel_Cell $pCell null{
  2865.         if ($tokens == falsereturn false;
  2866.  
  2867.         //    If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent worksheet),
  2868.         //        so we store the parent worksheet so that we can re-attach it when necessary
  2869.         $pCellParent (!is_null($pCell)) $pCell->getParent(null;
  2870.         $stack new PHPExcel_Token_Stack;
  2871.  
  2872.         //    Loop through each token in turn
  2873.         foreach ($tokens as $tokenData{
  2874. //            print_r($tokenData);
  2875. //            echo '<br />';
  2876.             $token $tokenData['value'];
  2877. //            echo '<b>Token is '.$token.'</b><br />';
  2878.             // if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack
  2879.             if (in_array($tokenself::$_binaryOperatorstrue)) {
  2880. //                echo 'Token is a binary operator<br />';
  2881.                 //    We must have two operands, error if we don't
  2882.                 if (is_null($operand2Data $stack->pop())) return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
  2883.                 if (is_null($operand1Data $stack->pop())) return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
  2884.                 //    Log what we're doing
  2885.                 $operand1 $operand1Data['value'];
  2886.                 $operand2 $operand2Data['value'];
  2887.                 if ($token == ':'{
  2888.                     $this->_writeDebug('Evaluating Range '.self::_showValue($operand1Data['reference']).$token.self::_showValue($operand2Data['reference']));
  2889.                 else {
  2890.                     $this->_writeDebug('Evaluating '.self::_showValue($operand1).' '.$token.' '.self::_showValue($operand2));
  2891.                 }
  2892.                 //    Process the operation in the appropriate manner
  2893.                 switch ($token{
  2894.                     //    Comparison (Boolean) Operators
  2895.                     case '>'    :            //    Greater than
  2896.                     case '<'    :            //    Less than
  2897.                     case '>='    :            //    Greater than or Equal to
  2898.                     case '<='    :            //    Less than or Equal to
  2899.                     case '='    :            //    Equality
  2900.                     case '<>'    :            //    Inequality
  2901.                         $this->_executeBinaryComparisonOperation($cellID,$operand1,$operand2,$token,$stack);
  2902.                         break;
  2903.                     //    Binary Operators
  2904.                     case ':'    :            //    Range
  2905.                         $sheet1 $sheet2 '';
  2906.                         if (strpos($operand1Data['reference'],'!'!== false{
  2907.                             list($sheet1,$operand1Data['reference']explode('!',$operand1Data['reference']);
  2908.                         else {
  2909.                             $sheet1 (!is_null($pCellParent)) $pCellParent->getTitle('';
  2910.                         }
  2911.                         if (strpos($operand2Data['reference'],'!'!== false{
  2912.                             list($sheet2,$operand2Data['reference']explode('!',$operand2Data['reference']);
  2913.                         else {
  2914.                             $sheet2 $sheet1;
  2915.                         }
  2916.                         if ($sheet1 == $sheet2{
  2917.                             if (is_null($operand1Data['reference'])) {
  2918.                                 if ((trim($operand1Data['value']!= ''&& (is_numeric($operand1Data['value']))) {
  2919.                                     $operand1Data['reference'$pCell->getColumn().$operand1Data['value'];
  2920.                                 elseif (trim($operand1Data['reference']== ''{
  2921.                                     $operand1Data['reference'$pCell->getColumn().$pCell->getRow();
  2922.                                 else {
  2923.                                     $operand1Data['reference'$operand1Data['value'].$pCell->getRow();
  2924.                                 }
  2925.                             }
  2926.                             if (is_null($operand2Data['reference'])) {
  2927.                                 if ((trim($operand2Data['value']!= ''&& (is_numeric($operand2Data['value']))) {
  2928.                                     $operand2Data['reference'$pCell->getColumn().$operand2Data['value'];
  2929.                                 elseif (trim($operand2Data['reference']== ''{
  2930.                                     $operand2Data['reference'$pCell->getColumn().$pCell->getRow();
  2931.                                 else {
  2932.                                     $operand2Data['reference'$operand2Data['value'].$pCell->getRow();
  2933.                                 }
  2934.                             }
  2935.  
  2936.                             $oData array_merge(explode(':',$operand1Data['reference']),explode(':',$operand2Data['reference']));
  2937.                             $oCol $oRow array();
  2938.                             foreach($oData as $oDatum{
  2939.                                 $oCR PHPExcel_Cell::coordinateFromString($oDatum);
  2940.                                 $oCol[PHPExcel_Cell::columnIndexFromString($oCR[0]1;
  2941.                                 $oRow[$oCR[1];
  2942.                             }
  2943.                             $cellRef PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
  2944.                             if (!is_null($pCellParent)) {
  2945.                                 $cellValue $this->extractCellRange($cellRef$pCellParent->getParent()->getSheetByName($sheet1)false);
  2946.                             else {
  2947.                                 return $this->_raiseFormulaError('Unable to access Cell Reference');
  2948.                             }
  2949.                             $stack->push('Cell Reference',$cellValue,$cellRef);
  2950.                         else {
  2951.                             $stack->push('Error',PHPExcel_Calculation_Functions::REF(),NULL);
  2952.                         }
  2953.  
  2954.                         break;
  2955.                     case '+'    :            //    Addition
  2956.                         $this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'plusEquals',$stack);
  2957.                         break;
  2958.                     case '-'    :            //    Subtraction
  2959.                         $this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'minusEquals',$stack);
  2960.                         break;
  2961.                     case '*'    :            //    Multiplication
  2962.                         $this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'arrayTimesEquals',$stack);
  2963.                         break;
  2964.                     case '/'    :            //    Division
  2965.                         $this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'arrayRightDivide',$stack);
  2966.                         break;
  2967.                     case '^'    :            //    Exponential
  2968.                         $this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'power',$stack);
  2969.                         break;
  2970.                     case '&'    :            //    Concatenation
  2971.                         //    If either of the operands is a matrix, we need to treat them both as matrices
  2972.                         //        (converting the other operand to a matrix if need be); then perform the required
  2973.                         //        matrix operation
  2974.                         if (is_bool($operand1)) {
  2975.                             $operand1 ($operand1self::$_localeBoolean['TRUE'self::$_localeBoolean['FALSE'];
  2976.                         }
  2977.                         if (is_bool($operand2)) {
  2978.                             $operand2 ($operand2self::$_localeBoolean['TRUE'self::$_localeBoolean['FALSE'];
  2979.                         }
  2980.                         if ((is_array($operand1)) || (is_array($operand2))) {
  2981.                             //    Ensure that both operands are arrays/matrices
  2982.                             self::_checkMatrixOperands($operand1,$operand2,2);
  2983.                             try {
  2984.                                 //    Convert operand 1 from a PHP array to a matrix
  2985.                                 $matrix new Matrix($operand1);
  2986.                                 //    Perform the required operation against the operand 1 matrix, passing in operand 2
  2987.                                 $matrixResult $matrix->concat($operand2);
  2988.                                 $result $matrixResult->getArray();
  2989.                             catch (Exception $ex{
  2990.                                 $this->_writeDebug('JAMA Matrix Exception: '.$ex->getMessage());
  2991.                                 $result '#VALUE!';
  2992.                             }
  2993.                         else {
  2994.                             $result '"'.str_replace('""','"',self::_unwrapResult($operand1,'"').self::_unwrapResult($operand2,'"')).'"';
  2995.                         }
  2996.                         $this->_writeDebug('Evaluation Result is '.self::_showTypeDetails($result));
  2997.                         $stack->push('Value',$result);
  2998.                         break;
  2999.                     case '|'    :            //    Intersect
  3000.                         $rowIntersect array_intersect_key($operand1,$operand2);
  3001.                         $cellIntersect $oCol $oRow array();
  3002.                         foreach(array_keys($rowIntersectas $col{
  3003.                             $oCol[PHPExcel_Cell::columnIndexFromString($col1;
  3004.                             $cellIntersect[$colarray_intersect_key($operand1[$col],$operand2[$col]);
  3005.                             foreach($cellIntersect[$colas $row => $data{
  3006.                                 $oRow[$row;
  3007.                             }
  3008.                         }
  3009.                         $cellRef PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
  3010.                         $this->_writeDebug('Evaluation Result is '.self::_showTypeDetails($cellIntersect));
  3011.                         $stack->push('Value',$cellIntersect,$cellRef);
  3012.                         break;
  3013.                 }
  3014.  
  3015.             // if the token is a unary operator, pop one value off the stack, do the operation, and push it back on
  3016.             elseif (($token === '~'|| ($token === '%')) {
  3017. //                echo 'Token is a unary operator<br />';
  3018.                 if (is_null($arg $stack->pop())) return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
  3019.                 $arg $arg['value'];
  3020.                 if ($token === '~'{
  3021. //                    echo 'Token is a negation operator<br />';
  3022.                     $this->_writeDebug('Evaluating Negation of '.self::_showValue($arg));
  3023.                     $multiplier = -1;
  3024.                 else {
  3025. //                    echo 'Token is a percentile operator<br />';
  3026.                     $this->_writeDebug('Evaluating Percentile of '.self::_showValue($arg));
  3027.                     $multiplier 0.01;
  3028.                 }
  3029.                 if (is_array($arg)) {
  3030.                     self::_checkMatrixOperands($arg,$multiplier,2);
  3031.                     try {
  3032.                         $matrix1 new Matrix($arg);
  3033.                         $matrixResult $matrix1->arrayTimesEquals($multiplier);
  3034.                         $result $matrixResult->getArray();
  3035.                     catch (Exception $ex{
  3036.                         $this->_writeDebug('JAMA Matrix Exception: '.$ex->getMessage());
  3037.                         $result '#VALUE!';
  3038.                     }
  3039.                     $this->_writeDebug('Evaluation Result is '.self::_showTypeDetails($result));
  3040.                     $stack->push('Value',$result);
  3041.                 else {
  3042.                     $this->_executeNumericBinaryOperation($cellID,$multiplier,$arg,'*','arrayTimesEquals',$stack);
  3043.                 }
  3044.  
  3045.             elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i'$token$matches)) {
  3046.                 $cellRef null;
  3047. //                echo 'Element '.$token.' is a Cell reference<br />';
  3048.                 if (isset($matches[8])) {
  3049. //                    echo 'Reference is a Range of cells<br />';
  3050.                     if (is_null($pCell)) {
  3051. //                        We can't access the range, so return a REF error
  3052.                         $cellValue PHPExcel_Calculation_Functions::REF();
  3053.                     else {
  3054.                         $cellRef $matches[6].$matches[7].':'.$matches[9].$matches[10];
  3055.                         if ($matches[2''{
  3056.                             $matches[2trim($matches[2],"\"'");
  3057. //                            echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
  3058.                             $this->_writeDebug('Evaluating Cell Range '.$cellRef.' in worksheet '.$matches[2]);
  3059.                             if (!is_null($pCellParent)) {
  3060.                                 $cellValue $this->extractCellRange($cellRef$pCellParent->getParent()->getSheetByName($matches[2])false);
  3061.                             else {
  3062.                                 return $this->_raiseFormulaError('Unable to access Cell Reference');
  3063.                             }
  3064.                             $this->_writeDebug('Evaluation Result for cells '.$cellRef.' in worksheet '.$matches[2].' is '.self::_showTypeDetails($cellValue));
  3065.                             $cellRef $matches[2].'!'.$cellRef;
  3066.                         else {
  3067. //                            echo '$cellRef='.$cellRef.' in current worksheet<br />';
  3068.                             $this->_writeDebug('Evaluating Cell Range '.$cellRef.' in current worksheet');
  3069.                             if (!is_null($pCellParent)) {
  3070.                                 $cellValue $this->extractCellRange($cellRef$pCellParentfalse);
  3071.                             else {
  3072.                                 return $this->_raiseFormulaError('Unable to access Cell Reference');
  3073.                             }
  3074.                             $this->_writeDebug('Evaluation Result for cells '.$cellRef.' is '.self::_showTypeDetails($cellValue));
  3075.                         }
  3076.                     }
  3077.                 else {
  3078. //                    echo 'Reference is a single Cell<br />';
  3079.                     if (is_null($pCell)) {
  3080. //                        We can't access the cell, so return a REF error
  3081.                         $cellValue PHPExcel_Calculation_Functions::REF();
  3082.                     else {
  3083.                         $cellRef $matches[6].$matches[7];
  3084.                         if ($matches[2''{
  3085.                             $matches[2trim($matches[2],"\"'");
  3086. //                            echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
  3087.                             $this->_writeDebug('Evaluating Cell '.$cellRef.' in worksheet '.$matches[2]);
  3088.                             if (!is_null($pCellParent)) {
  3089.                                 if ($pCellParent->getParent()->getSheetByName($matches[2])->cellExists($cellRef)) {
  3090.                                     $cellValue $this->extractCellRange($cellRef$pCellParent->getParent()->getSheetByName($matches[2])false);
  3091.                                     $pCell->attach($pCellParent);
  3092.                                 else {
  3093.                                     $cellValue PHPExcel_Calculation_Functions::REF();
  3094.                                 }
  3095.                             else {
  3096.                                 return $this->_raiseFormulaError('Unable to access Cell Reference');
  3097.                             }
  3098.                             $this->_writeDebug('Evaluation Result for cell '.$cellRef.' in worksheet '.$matches[2].' is '.self::_showTypeDetails($cellValue));
  3099.                             $cellRef $matches[2].'!'.$cellRef;
  3100.                         else {
  3101. //                            echo '$cellRef='.$cellRef.' in current worksheet<br />';
  3102.                             $this->_writeDebug('Evaluating Cell '.$cellRef.' in current worksheet');
  3103.                             if ($pCellParent->cellExists($cellRef)) {
  3104.                                 $cellValue $this->extractCellRange($cellRef$pCellParentfalse);
  3105.                                 $pCell->attach($pCellParent);
  3106.                             else {
  3107.                                 $cellValue NULL;
  3108.                             }
  3109.                             $this->_writeDebug('Evaluation Result for cell '.$cellRef.' is '.self::_showTypeDetails($cellValue));
  3110.                         }
  3111.                     }
  3112.                 }
  3113.                 $stack->push('Value',$cellValue,$cellRef);
  3114.  
  3115.             // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
  3116.             elseif (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i'$token$matches)) {
  3117. //                echo 'Token is a function<br />';
  3118.                 $functionName $matches[1];
  3119.                 $argCount $stack->pop();
  3120.                 $argCount $argCount['value'];
  3121.                 if ($functionName != 'MKMATRIX'{
  3122.                     $this->_writeDebug('Evaluating Function '.self::_localeFunc($functionName).'() with '.(($argCount == 0'no' $argCount).' argument'.(($argCount == 1'' 's'));
  3123.                 }
  3124.                 if ((array_key_exists($functionNameself::$_PHPExcelFunctions)) || (array_key_exists($functionNameself::$_controlFunctions))) {    // function
  3125.                     if (array_key_exists($functionNameself::$_PHPExcelFunctions)) {
  3126.                         $functionCall self::$_PHPExcelFunctions[$functionName]['functionCall'];
  3127.                         $passByReference = isset(self::$_PHPExcelFunctions[$functionName]['passByReference']);
  3128.                         $passCellReference = isset(self::$_PHPExcelFunctions[$functionName]['passCellReference']);
  3129.                     elseif (array_key_exists($functionNameself::$_controlFunctions)) {
  3130.                         $functionCall self::$_controlFunctions[$functionName]['functionCall'];
  3131.                         $passByReference = isset(self::$_controlFunctions[$functionName]['passByReference']);
  3132.                         $passCellReference = isset(self::$_controlFunctions[$functionName]['passCellReference']);
  3133.                     }
  3134.                     // get the arguments for this function
  3135. //                    echo 'Function '.$functionName.' expects '.$argCount.' arguments<br />';
  3136.                     $args $argArrayVals array();
  3137.                     for ($i 0$i $argCount++$i{
  3138.                         $arg $stack->pop();
  3139.                         $a $argCount $i 1;
  3140.                         if (($passByReference&&
  3141.                             (isset(self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) &&
  3142.                             (self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) {
  3143.                             if (is_null($arg['reference'])) {
  3144.                                 $args[$cellID;
  3145.                                 if ($functionName != 'MKMATRIX'$argArrayVals[self::_showValue($cellID)}
  3146.                             else {
  3147.                                 $args[$arg['reference'];
  3148.                                 if ($functionName != 'MKMATRIX'$argArrayVals[self::_showValue($arg['reference'])}
  3149.                             }
  3150.                         else {
  3151.                             $args[self::_unwrapResult($arg['value']);
  3152.                             if ($functionName != 'MKMATRIX'$argArrayVals[self::_showValue($arg['value'])}
  3153.                         }
  3154.                     }
  3155.                     //    Reverse the order of the arguments
  3156.                     krsort($args);
  3157.                     if (($passByReference&& ($argCount == 0)) {
  3158.                         $args[$cellID;
  3159.                         $argArrayVals[self::_showValue($cellID);
  3160.                     }
  3161. //                    echo 'Arguments are: ';
  3162. //                    print_r($args);
  3163. //                    echo '<br />';
  3164.                     if ($functionName != 'MKMATRIX'{
  3165.                         krsort($argArrayVals);
  3166.                         $this->_writeDebug('Evaluating 'self::_localeFunc($functionName).'( '.implode(self::$_localeArgumentSeparator.' ',$argArrayVals).' )');
  3167.                     }
  3168.                     //    Process each argument in turn, building the return value as an array
  3169. //                    if (($argCount == 1) && (is_array($args[1])) && ($functionName != 'MKMATRIX')) {
  3170. //                        $operand1 = $args[1];
  3171. //                        $this->_writeDebug('Argument is a matrix: '.self::_showValue($operand1));
  3172. //                        $result = array();
  3173. //                        $row = 0;
  3174. //                        foreach($operand1 as $args) {
  3175. //                            if (is_array($args)) {
  3176. //                                foreach($args as $arg) {
  3177. //                                    $this->_writeDebug('Evaluating '.self::_localeFunc($functionName).'( '.self::_showValue($arg).' )');
  3178. //                                    $r = call_user_func_array($functionCall,$arg);
  3179. //                                    $this->_writeDebug('Evaluation Result for '.self::_localeFunc($functionName).'() function call is '.self::_showTypeDetails($r));
  3180. //                                    $result[$row][] = $r;
  3181. //                                }
  3182. //                                ++$row;
  3183. //                            } else {
  3184. //                                $this->_writeDebug('Evaluating '.self::_localeFunc($functionName).'( '.self::_showValue($args).' )');
  3185. //                                $r = call_user_func_array($functionCall,$args);
  3186. //                                $this->_writeDebug('Evaluation Result for '.self::_localeFunc($functionName).'() function call is '.self::_showTypeDetails($r));
  3187. //                                $result[] = $r;
  3188. //                            }
  3189. //                        }
  3190. //                    } else {
  3191.                     //    Process the argument with the appropriate function call
  3192.                         if ($passCellReference{
  3193.                             $args[$pCell;
  3194.                         }
  3195.                         if (strpos($functionCall,'::'!== false{
  3196.                             $result call_user_func_array(explode('::',$functionCall),$args);
  3197.                         else {
  3198.                             foreach($args as &$arg{
  3199.                                 $arg PHPExcel_Calculation_Functions::flattenSingleValue($arg);
  3200.                             }
  3201.                             unset($arg);
  3202.                             $result call_user_func_array($functionCall,$args);
  3203.                         }
  3204. //                    }
  3205.                     if ($functionName != 'MKMATRIX'{
  3206.                         $this->_writeDebug('Evaluation Result for '.self::_localeFunc($functionName).'() function call is '.self::_showTypeDetails($result));
  3207.                     }
  3208.                     $stack->push('Value',self::_wrapResult($result));
  3209.                 }
  3210.  
  3211.             else {
  3212.                 // if the token is a number, boolean, string or an Excel error, push it onto the stack
  3213.                 if (array_key_exists(strtoupper($token)self::$_ExcelConstants)) {
  3214.                     $excelConstant strtoupper($token);
  3215. //                    echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />';
  3216.                     $stack->push('Constant Value',self::$_ExcelConstants[$excelConstant]);
  3217.                     $this->_writeDebug('Evaluating Constant '.$excelConstant.' as '.self::_showTypeDetails(self::$_ExcelConstants[$excelConstant]));
  3218.                 elseif ((is_numeric($token)) || (is_bool($token)) || (is_null($token)) || ($token == ''|| ($token{0== '"'|| ($token{0== '#')) {
  3219. //                    echo 'Token is a number, boolean, string, null or an Excel error<br />';
  3220.                     $stack->push('Value',$token);
  3221.                 // if the token is a named range, push the named range name onto the stack
  3222.                 elseif (preg_match('/^'.self::CALCULATION_REGEXP_NAMEDRANGE.'$/i'$token$matches)) {
  3223. //                    echo 'Token is a named range<br />';
  3224.                     $namedRange $matches[6];
  3225. //                    echo 'Named Range is '.$namedRange.'<br />';
  3226.                     $this->_writeDebug('Evaluating Named Range '.$namedRange);
  3227.                     $cellValue $this->extractNamedRange($namedRange((null !== $pCell$pCellParent null)false);
  3228.                     $pCell->attach($pCellParent);
  3229.                     $this->_writeDebug('Evaluation Result for named range '.$namedRange.' is '.self::_showTypeDetails($cellValue));
  3230.                     $stack->push('Named Range',$cellValue,$namedRange);
  3231.                 else {
  3232.                     return $this->_raiseFormulaError("undefined variable '$token'");
  3233.                 }
  3234.             }
  3235.         }
  3236.         // when we're out of tokens, the stack should have a single element, the final result
  3237.         if ($stack->count(!= 1return $this->_raiseFormulaError("internal error");
  3238.         $output $stack->pop();
  3239.         $output $output['value'];
  3240.  
  3241. //        if ((is_array($output)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) {
  3242. //            return array_shift(PHPExcel_Calculation_Functions::flattenArray($output));
  3243. //        }
  3244.         return $output;
  3245.     }    //    function _processTokenStack()
  3246.  
  3247.  
  3248.     private function _validateBinaryOperand($cellID,&$operand,&$stack{
  3249.         //    Numbers, matrices and booleans can pass straight through, as they're already valid
  3250.         if (is_string($operand)) {
  3251.             //    We only need special validations for the operand if it is a string
  3252.             //    Start by stripping off the quotation marks we use to identify true excel string values internally
  3253.             if ($operand '' && $operand{0== '"'$operand self::_unwrapResult($operand)}
  3254.             //    If the string is a numeric value, we treat it as a numeric, so no further testing
  3255.             if (!is_numeric($operand)) {
  3256.                 //    If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations
  3257.                 if ($operand '' && $operand{0== '#'{
  3258.                     $stack->push('Value'$operand);
  3259.                     $this->_writeDebug('Evaluation Result is '.self::_showTypeDetails($operand));
  3260.                     return false;
  3261.                 elseif (!PHPExcel_Shared_String::convertToNumberIfFraction($operand)) {
  3262.                     //    If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations
  3263.                     $stack->push('Value''#VALUE!');
  3264.                     $this->_writeDebug('Evaluation Result is a '.self::_showTypeDetails('#VALUE!'));
  3265.                     return false;
  3266.                 }
  3267.             }
  3268.         }
  3269.  
  3270.         //    return a true if the value of the operand is one that we can use in normal binary operations
  3271.         return true;
  3272.     }    //    function _validateBinaryOperand()
  3273.  
  3274.  
  3275.     private function _executeBinaryComparisonOperation($cellID,$operand1,$operand2,$operation,&$stack,$recursingArrays=false{
  3276.         //    If we're dealing with matrix operations, we want a matrix result
  3277.         if ((is_array($operand1)) || (is_array($operand2))) {
  3278.             $result array();
  3279.             if ((is_array($operand1)) && (!is_array($operand2))) {
  3280.                 foreach($operand1 as $x => $operandData{
  3281.                     $this->_writeDebug('Evaluating '.self::_showValue($operandData).' '.$operation.' '.self::_showValue($operand2));
  3282.                     $this->_executeBinaryComparisonOperation($cellID,$operandData,$operand2,$operation,$stack);
  3283.                     $r $stack->pop();
  3284.                     $result[$x$r['value'];
  3285.                 }
  3286.             elseif ((!is_array($operand1)) && (is_array($operand2))) {
  3287.                 foreach($operand2 as $x => $operandData{
  3288.                     $this->_writeDebug('Evaluating '.self::_showValue($operand1).' '.$operation.' '.self::_showValue($operandData));
  3289.                     $this->_executeBinaryComparisonOperation($cellID,$operand1,$operandData,$operation,$stack);
  3290.                     $r $stack->pop();
  3291.                     $result[$x$r['value'];
  3292.                 }
  3293.             else {
  3294.                 if (!$recursingArraysself::_checkMatrixOperands($operand1,$operand2,2)}
  3295.                 foreach($operand1 as $x => $operandData{
  3296.                     $this->_writeDebug('Evaluating '.self::_showValue($operandData).' '.$operation.' '.self::_showValue($operand2[$x]));
  3297.                     $this->_executeBinaryComparisonOperation($cellID,$operandData,$operand2[$x],$operation,$stack,True);
  3298.                     $r $stack->pop();
  3299.                     $result[$x$r['value'];
  3300.                 }
  3301.             }
  3302.             //    Log the result details
  3303.             $this->_writeDebug('Evaluation Result is '.self::_showTypeDetails($result));
  3304.             //    And push the result onto the stack
  3305.             $stack->push('Array',$result);
  3306.             return true;
  3307.         }
  3308.  
  3309.         //    Simple validate the two operands if they are string values
  3310.         if (is_string($operand1&& $operand1 '' && $operand1{0== '"'$operand1 self::_unwrapResult($operand1)}
  3311.         if (is_string($operand2&& $operand2 '' && $operand2{0== '"'$operand2 self::_unwrapResult($operand2)}
  3312.  
  3313.         //    execute the necessary operation
  3314.         switch ($operation{
  3315.             //    Greater than
  3316.             case '>':
  3317.                 $result ($operand1 $operand2);
  3318.                 break;
  3319.             //    Less than
  3320.             case '<':
  3321.                 $result ($operand1 $operand2);
  3322.                 break;
  3323.             //    Equality
  3324.             case '=':
  3325.                 $result ($operand1 == $operand2);
  3326.                 break;
  3327.             //    Greater than or equal
  3328.             case '>=':
  3329.                 $result ($operand1 >= $operand2);
  3330.                 break;
  3331.             //    Less than or equal
  3332.             case '<=':
  3333.                 $result ($operand1 <= $operand2);
  3334.                 break;
  3335.             //    Inequality
  3336.             case '<>':
  3337.                 $result ($operand1 != $operand2);
  3338.                 break;
  3339.         }
  3340.  
  3341.         //    Log the result details
  3342.         $this->_writeDebug('Evaluation Result is '.self::_showTypeDetails($result));
  3343.         //    And push the result onto the stack
  3344.         $stack->push('Value',$result);
  3345.         return true;
  3346.     }    //    function _executeBinaryComparisonOperation()
  3347.  
  3348.  
  3349.     private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack{
  3350.         //    Validate the two operands
  3351.         if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) return false;
  3352.         if (!$this->_validateBinaryOperand($cellID,$operand2,$stack)) return false;
  3353.  
  3354.         //    If either of the operands is a matrix, we need to treat them both as matrices
  3355.         //        (converting the other operand to a matrix if need be); then perform the required
  3356.         //        matrix operation
  3357.         if ((is_array($operand1)) || (is_array($operand2))) {
  3358.             //    Ensure that both operands are arrays/matrices
  3359.             self::_checkMatrixOperands($operand1,$operand2,2);
  3360.             try {
  3361.                 //    Convert operand 1 from a PHP array to a matrix
  3362.                 $matrix new Matrix($operand1);
  3363.                 //    Perform the required operation against the operand 1 matrix, passing in operand 2
  3364.                 $matrixResult $matrix->$matrixFunction($operand2);
  3365.                 $result $matrixResult->getArray();
  3366.             catch (Exception $ex{
  3367.                 $this->_writeDebug('JAMA Matrix Exception: '.$ex->getMessage());
  3368.                 $result '#VALUE!';
  3369.             }
  3370.         else {
  3371.             //    If we're dealing with non-matrix operations, execute the necessary operation
  3372.             switch ($operation{
  3373.                 //    Addition
  3374.                 case '+':
  3375.                     $result $operand1+$operand2;
  3376.                     break;
  3377.                 //    Subtraction
  3378.                 case '-':
  3379.                     $result $operand1-$operand2;
  3380.                     break;
  3381.                 //    Multiplication
  3382.                 case '*':
  3383.                     $result $operand1*$operand2;
  3384.                     break;
  3385.                 //    Division
  3386.                 case '/':
  3387.                     if ($operand2 == 0{
  3388.                         //    Trap for Divide by Zero error
  3389.                         $stack->push('Value','#DIV/0!');
  3390.                         $this->_writeDebug('Evaluation Result is '.self::_showTypeDetails('#DIV/0!'));
  3391.                         return false;
  3392.                     else {
  3393.                         $result $operand1/$operand2;
  3394.                     }
  3395.                     break;
  3396.                 //    Power
  3397.                 case '^':
  3398.                     $result pow($operand1,$operand2);
  3399.                     break;
  3400.             }
  3401.         }
  3402.  
  3403.         //    Log the result details
  3404.         $this->_writeDebug('Evaluation Result is '.self::_showTypeDetails($result));
  3405.         //    And push the result onto the stack
  3406.         $stack->push('Value',$result);
  3407.         return true;
  3408.     }    //    function _executeNumericBinaryOperation()
  3409.  
  3410.  
  3411.     private function _writeDebug($message{
  3412.         //    Only write the debug log if logging is enabled
  3413.         if ($this->writeDebugLog{
  3414.             $this->debugLog[implode(' -> ',$this->debugLogStack).' -> '.$message;
  3415.         }
  3416.     }    //    function _writeDebug()
  3417.  
  3418.  
  3419.     // trigger an error, but nicely, if need be
  3420.     protected function _raiseFormulaError($errorMessage{
  3421.         $this->formulaError $errorMessage;
  3422.         if (!$this->suppressFormulaErrorsthrow new Exception($errorMessage);
  3423.         trigger_error($errorMessageE_USER_ERROR);
  3424.     }    //    function _raiseFormulaError()
  3425.  
  3426.  
  3427.     /**
  3428.      * Extract range values
  3429.      *
  3430.      * @param    string                &$pRange        String based range representation
  3431.      * @param    PHPExcel_Worksheet    $pSheet        Worksheet
  3432.      * @return  mixed                Array of values in range if range contains more than one element. Otherwise, a single value is returned.
  3433.      * @throws    Exception
  3434.      */
  3435.     public function extractCellRange(&$pRange 'A1'PHPExcel_Worksheet $pSheet null$resetLog=true{
  3436.         // Return value
  3437.         $returnValue array ();
  3438.  
  3439. //        echo 'extractCellRange('.$pRange.')<br />';
  3440.         if (!is_null($pSheet)) {
  3441. //            echo 'Passed sheet name is '.$pSheet->getTitle().'<br />';
  3442. //            echo 'Range reference is '.$pRange.'<br />';
  3443.             if (strpos ($pRange'!'!== false{
  3444. //                echo '$pRange reference includes sheet reference<br />';
  3445.                 $worksheetReference PHPExcel_Worksheet::extractSheetTitle($pRangetrue);
  3446.                 $pSheet $pSheet->getParent()->getSheetByName($worksheetReference[0]);
  3447. //                echo 'New sheet name is '.$pSheet->getTitle().'<br />';
  3448.                 $pRange $worksheetReference[1];
  3449. //                echo 'Adjusted Range reference is '.$pRange.'<br />';
  3450.             }
  3451.  
  3452.             // Extract range
  3453.             $aReferences PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
  3454.             $pRange $pSheet->getTitle().'!'.$pRange;
  3455.             if (count($aReferences== 1{
  3456.                 list($currentCol,$currentRowPHPExcel_Cell::coordinateFromString($aReferences[0]);
  3457.                 if ($pSheet->cellExists($aReferences[0])) {
  3458.                     $returnValue[$currentRow][$currentCol$pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
  3459.                 else {
  3460.                     $returnValue[$currentRow][$currentColNULL;
  3461.                 }
  3462.             else {
  3463.                 // Extract cell data
  3464.                 foreach ($aReferences as $reference{
  3465.                     // Extract range
  3466.                     list($currentCol,$currentRowPHPExcel_Cell::coordinateFromString($reference);
  3467.  
  3468.                     if ($pSheet->cellExists($reference)) {
  3469.                         $returnValue[$currentRow][$currentCol$pSheet->getCell($reference)->getCalculatedValue($resetLog);
  3470.                     else {
  3471.                         $returnValue[$currentRow][$currentColNULL;
  3472.                     }
  3473.                 }
  3474.             }
  3475.         }
  3476.  
  3477.         // Return
  3478.         return $returnValue;
  3479.     }    //    function extractCellRange()
  3480.  
  3481.  
  3482.     /**
  3483.      * Extract range values
  3484.      *
  3485.      * @param    string                &$pRange    String based range representation
  3486.      * @param    PHPExcel_Worksheet    $pSheet        Worksheet
  3487.      * @return  mixed                Array of values in range if range contains more than one element. Otherwise, a single value is returned.
  3488.      * @throws    Exception
  3489.      */
  3490.     public function extractNamedRange(&$pRange 'A1'PHPExcel_Worksheet $pSheet null$resetLog=true{
  3491.         // Return value
  3492.         $returnValue array ();
  3493.  
  3494. //        echo 'extractNamedRange('.$pRange.')<br />';
  3495.         if (!is_null($pSheet)) {
  3496. //            echo 'Current sheet name is '.$pSheet->getTitle().'<br />';
  3497. //            echo 'Range reference is '.$pRange.'<br />';
  3498.             if (strpos ($pRange'!'!== false{
  3499. //                echo '$pRange reference includes sheet reference<br />';
  3500.                 $worksheetReference PHPExcel_Worksheet::extractSheetTitle($pRangetrue);
  3501.                 $pSheet $pSheet->getParent()->getSheetByName($worksheetReference[0]);
  3502. //                echo 'New sheet name is '.$pSheet->getTitle().'<br />';
  3503.                 $pRange $worksheetReference[1];
  3504. //                echo 'Adjusted Range reference is '.$pRange.'<br />';
  3505.             }
  3506.  
  3507.             // Named range?
  3508.             $namedRange PHPExcel_NamedRange::resolveRange($pRange$pSheet);
  3509.             if (!is_null($namedRange)) {
  3510.                 $pSheet $namedRange->getWorksheet();
  3511. ////            echo 'Named Range '.$pRange.' (';
  3512.                 $pRange $namedRange->getRange();
  3513. ////                echo $pRange.') is in sheet '.$namedRange->getWorksheet()->getTitle().'<br />';
  3514. //                if ($pSheet->getTitle() != $namedRange->getWorksheet()->getTitle()) {
  3515. //                    if (!$namedRange->getLocalOnly()) {
  3516. //                        $pSheet = $namedRange->getWorksheet();
  3517. //                    } else {
  3518. //                        return $returnValue;
  3519. //                    }
  3520. //                }
  3521.             else {
  3522.                 return PHPExcel_Calculation_Functions::REF();
  3523.             }
  3524.  
  3525.             // Extract range
  3526.             $aReferences PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
  3527.             if (count($aReferences== 1{
  3528.                 list($currentCol,$currentRowPHPExcel_Cell::coordinateFromString($aReferences[0]);
  3529.                 if ($pSheet->cellExists($aReferences[0])) {
  3530.                     $returnValue[$currentRow][$currentCol$pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
  3531.                 else {
  3532.                     $returnValue[$currentRow][$currentColNULL;
  3533.                 }
  3534.             else {
  3535.                 // Extract cell data
  3536.                 foreach ($aReferences as $reference{
  3537.                     // Extract range
  3538.                     list($currentCol,$currentRowPHPExcel_Cell::coordinateFromString($reference);
  3539. //                    echo 'NAMED RANGE: $currentCol='.$currentCol.' $currentRow='.$currentRow.'<br />';
  3540.                     if ($pSheet->cellExists($reference)) {
  3541.                         $returnValue[$currentRow][$currentCol$pSheet->getCell($reference)->getCalculatedValue($resetLog);
  3542.                     else {
  3543.                         $returnValue[$currentRow][$currentColNULL;
  3544.                     }
  3545.                 }
  3546.             }
  3547. //                print_r($returnValue);
  3548. //            echo '<br />';
  3549.         }
  3550.  
  3551.         // Return
  3552.         return $returnValue;
  3553.     }    //    function extractNamedRange()
  3554.  
  3555.  
  3556.     /**
  3557.      * Is a specific function implemented?
  3558.      *
  3559.      * @param    string    $pFunction    Function Name
  3560.      * @return    boolean 
  3561.      */
  3562.     public function isImplemented($pFunction ''{
  3563.         $pFunction strtoupper ($pFunction);
  3564.         if (isset(self::$_PHPExcelFunctions[$pFunction])) {
  3565.             return (self::$_PHPExcelFunctions[$pFunction]['functionCall'!= 'PHPExcel_Calculation_Functions::DUMMY');
  3566.         else {
  3567.             return false;
  3568.         }
  3569.     }    //    function isImplemented()
  3570.  
  3571.  
  3572.     /**
  3573.      * Get a list of all implemented functions as an array of function objects
  3574.      *
  3575.      * @return    array of PHPExcel_Calculation_Function
  3576.      */
  3577.     public function listFunctions({
  3578.         // Return value
  3579.         $returnValue array();
  3580.         // Loop functions
  3581.         foreach(self::$_PHPExcelFunctions as $functionName => $function{
  3582.             if ($function['functionCall'!= 'PHPExcel_Calculation_Functions::DUMMY'{
  3583.                 $returnValue[$functionNamenew PHPExcel_Calculation_Function($function['category'],
  3584.                                                                                 $functionName,
  3585.                                                                                 $function['functionCall']
  3586.                                                                                );
  3587.             }
  3588.         }
  3589.  
  3590.         // Return
  3591.         return $returnValue;
  3592.     }    //    function listFunctions()
  3593.  
  3594.  
  3595.     /**
  3596.      * Get a list of implemented Excel function names
  3597.      *
  3598.      * @return    array 
  3599.      */
  3600.     public function listFunctionNames({
  3601.         return array_keys(self::$_PHPExcelFunctions);
  3602.     }    //    function listFunctionNames()
  3603.  
  3604. }    //    class PHPExcel_Calculation
  3605.  
  3606.  
  3607.  
  3608.  
  3609. // for internal use
  3610.  
  3611.     private $_stack array();
  3612.     private $_count 0;
  3613.  
  3614.  
  3615.     public function count({
  3616.         return $this->_count;
  3617.     }    //    function count()
  3618.  
  3619.  
  3620.     public function push($type,$value,$reference=null{
  3621.         $this->_stack[$this->_count++array('type'        => $type,
  3622.                                                'value'        => $value,
  3623.                                                'reference'    => $reference
  3624.                                               );
  3625.         if ($type == 'Function'{
  3626.             $localeFunction PHPExcel_Calculation::_localeFunc($value);
  3627.             if ($localeFunction != $value{
  3628.                 $this->_stack[($this->_count 1)]['localeValue'$localeFunction;
  3629.             }
  3630.         }
  3631.     }    //    function push()
  3632.  
  3633.  
  3634.     public function pop({
  3635.         if ($this->_count 0{
  3636.             return $this->_stack[--$this->_count];
  3637.         }
  3638.         return null;
  3639.     }    //    function pop()
  3640.  
  3641.  
  3642.     public function last($n=1{
  3643.         if ($this->_count-$n 0{
  3644.             return null;
  3645.         }
  3646.         return $this->_stack[$this->_count-$n];
  3647.     }    //    function last()
  3648.  
  3649.  
  3650.     function __construct({
  3651.     }
  3652.  
  3653. }    //    class PHPExcel_Token_Stack

Documentation generated on Tue, 01 Jun 2010 17:02:27 +0200 by phpDocumentor 1.4.3