You are here

class ctools_math_expr_stack in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 includes/math-expr.inc \ctools_math_expr_stack

Hierarchy

Expanded class hierarchy of ctools_math_expr_stack

File

includes/math-expr.inc, line 365

View source
class ctools_math_expr_stack {
  var $stack = array();
  var $count = 0;
  function push($val) {
    $this->stack[$this->count] = $val;
    $this->count++;
  }
  function pop() {
    if ($this->count > 0) {
      $this->count--;
      return $this->stack[$this->count];
    }
    return null;
  }
  function last($n = 1) {
    return !empty($this->stack[$this->count - $n]) ? $this->stack[$this->count - $n] : NULL;
  }

}

Members