Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

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

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 645 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 4 classes

EvalMath:: (2 methods):
  __construct()
  EvalMath()

name:: (9 methods):
  e()
  evaluate()
  vars()
  funcs()
  is_valid_var_or_func_name()
  nfx()
  get_native_function_name()
  pfx()
  trigger()

EvalMathStack:: (3 methods):
  push()
  pop()
  last()

EvalMathFuncs:: (15 methods):
  ifthenelse()
  cond_and()
  cond_or()
  average()
  max()
  min()
  mod()
  pi()
  power()
  round()
  sum()
  set_random_seed()
  get_random_seed()
  rand_int()
  rand_float()


Class: EvalMath  - X-Ref

This class was heavily modified in order to get usefull spreadsheet emulation ;-)
skodak
This class was modified to allow comparison operators (<, <=, ==, >=, >)
and synonyms functions (for the 'if' function). See MDL-14274 for more details.

__construct($allowconstants = false, $allowimplicitmultiplication = false)   X-Ref
No description

EvalMath($allowconstants = false, $allowimplicitmultiplication = false)   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

e($expr)   X-Ref
No description

evaluate($expr)   X-Ref
No description

vars()   X-Ref
No description

funcs()   X-Ref
No description

is_valid_var_or_func_name($name)   X-Ref

param: string $name
return: boolean Is this a valid var or function name?

nfx($expr)   X-Ref
No description

get_native_function_name($fnn)   X-Ref

param: string $fnn
return: string|boolean false if function name unknown.

pfx($tokens, $vars = array()   X-Ref
No description

trigger($msg)   X-Ref
No description

Class: EvalMathStack  - X-Ref

push($val)   X-Ref
No description

pop()   X-Ref
No description

last($n=1)   X-Ref
No description

Class: EvalMathFuncs  - X-Ref

ifthenelse($condition, $then, $else)   X-Ref
MDL-14274 new conditional function.

param: boolean $condition boolean for conditional.
param: variant $then value if condition is true.
param: unknown $else value if condition is false.
author: Juan Pablo de Castro <juan.pablo.de.castro@gmail.com>
return: unknown

cond_and()   X-Ref
No description

cond_or()   X-Ref
No description

average()   X-Ref
No description

max()   X-Ref
No description

min()   X-Ref
No description

mod($op1, $op2)   X-Ref
No description

pi()   X-Ref
No description

power($op1, $op2)   X-Ref
No description

round($val, $precision = 0)   X-Ref
No description

sum()   X-Ref
No description

set_random_seed($randomseed)   X-Ref
No description

get_random_seed()   X-Ref
No description

rand_int($min, $max)   X-Ref
No description

rand_float()   X-Ref
No description