This class abstracts evaluation of spreadsheet formulas.  
 More...
 | 
|   | __construct ($formula, $params=false) | 
|   | Constructor for spreadsheet formula with optional parameters.  More...
  | 
|   | 
|   | calc_formula ($formula, $params=false) | 
|   | Old syntax of class constructor.  More...
  | 
|   | 
|   | evaluate () | 
|   | Evaluate formula.  More...
  | 
|   | 
|   | get_error () | 
|   | Get last error.  More...
  | 
|   | 
|   | set_params ($params) | 
|   | Raplace parameters used in existing formula, parameter names must contain only lowercase [a-z] letters, no other characters are allowed!  More...
  | 
|   | 
 | 
| static  | localize ($formula) | 
|   | Similar to format_float, formats the numbers and list separators according to locale specifics.  More...
  | 
|   | 
| static  | unlocalize ($formula) | 
|   | Similar to unformat_float, converts floats and lists to PHP standards.  More...
  | 
|   | 
 | 
| 
  | $_em | 
|   | 
| 
  | $_error = false | 
|   | 
| 
  | $_nfx = false | 
|   | 
This class abstracts evaluation of spreadsheet formulas. 
- See also
 - evalmath/evalmath.class.php See unit tests in lib/tests/mathslib_test.php for sample usage.
 
- Copyright
 - Petr Skoda (skodak) 
 
- License
 - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
 
 
◆ __construct()
      
        
          | calc_formula::__construct  | 
          ( | 
            | 
          $formula,  | 
        
        
           | 
           | 
            | 
          $params = false  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Constructor for spreadsheet formula with optional parameters. 
- Parameters
 - 
  
    | string | $formula | with leading =  | 
    | array | $params | associative array of parameters used in formula. All parameter names must be lowercase!  | 
  
   
 
 
◆ calc_formula()
      
        
          | calc_formula::calc_formula  | 
          ( | 
            | 
          $formula,  | 
        
        
           | 
           | 
            | 
          $params = false  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Old syntax of class constructor. 
Deprecated in PHP7.
- Deprecated:
 - since Moodle 3.1 
 
 
 
◆ evaluate()
      
        
          | calc_formula::evaluate  | 
          ( | 
           | ) | 
           | 
        
      
 
Evaluate formula. 
- Return values
 - 
  
    | mixed | number if ok, false if error  | 
  
   
 
 
◆ get_error()
      
        
          | calc_formula::get_error  | 
          ( | 
           | ) | 
           | 
        
      
 
Get last error. 
TODO: localize the strings from contructor and EvalMath library
- Return values
 - 
  
    | mixed | string with last error description or false if ok  | 
  
   
 
 
◆ localize()
  
  
      
        
          | static calc_formula::localize  | 
          ( | 
            | 
          $formula | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Similar to format_float, formats the numbers and list separators according to locale specifics. 
- Parameters
 - 
  
  
 
- Return values
 - 
  
  
 
 
 
◆ set_params()
      
        
          | calc_formula::set_params  | 
          ( | 
            | 
          $params | ) | 
           | 
        
      
 
Raplace parameters used in existing formula, parameter names must contain only lowercase [a-z] letters, no other characters are allowed! 
- Parameters
 - 
  
    | array | $params | associative array of parameters used in formula  | 
  
   
 
 
◆ unlocalize()
  
  
      
        
          | static calc_formula::unlocalize  | 
          ( | 
            | 
          $formula | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Similar to unformat_float, converts floats and lists to PHP standards. 
- Parameters
 - 
  
    | string | $formula | localised formula  | 
  
   
- Return values
 - 
  
  
 
 
 
The documentation for this class was generated from the following file: