예제 #1
0
 /**
  * Evaluate a math expression
  *
  * @since 1.0.0
  *
  * @param string $expression without leading = sign
  * @return string Result of the evaluation
  */
 protected function _evaluate_math_expression($expression)
 {
     // straight up evaluation, without parsing of variable or function assignments (which is why we only need one instance of the object)
     $result = $this->evalmath->pfx($this->evalmath->nfx($expression));
     if (false === $result) {
         return '!ERROR! ' . $this->evalmath->last_error;
     } else {
         return $result;
     }
 }