src/Nuffle.php
public function calculate() {
    // reset the rolls array
    $this->rolls = array();

    // throw rolls and replace 'xdy' dice notation with results
    $this->equation = preg_replace_callback("/(?P<count>\d+)d(?P<sides>\d+)/i", "self::_expand_equation", $this->input);

    // calculate result
    $this->result = @eval("return $this->equation;");

    return $this;
  }
public function calculate() {
    // reset the rolls array
    $this->rolls = array();

    // throw rolls and replace 'xdy' dice notation with results
    $this->equation = preg_replace_callback("/(?P<count>\d+)d(?P<sides>\d+)/i", "self::_expand_equation", $this->input);

    // calculate result
    $this->result = @eval("return $this->equation;");

    return $this;
  }
public function calculate ( ) { // reset the rolls array $ this -> rolls = array ( ) ; // throw rolls and replace 'xdy' dice notation with results $ this -> equation = preg_replace_callback ( "/(?P<count>\d+)d(?P<sides>\d+)/i" , "self::_expand_equation" , $ this -> input ) ; // calculate result $ this -> result = @ eval ( "return $this->equation;" ) ; return $ this ; }
Calculate the results based on the user input

@return object
Calculate the results based on the user input