src/Nuffle.php
private function _expand_equation($matches) {
    $rolls = array();

    for ( $i = 0; $i < $matches['count']; $i++ ) {
      $rolls[] = mt_rand(1, $matches['sides']);
    }

    // save individual roll results
    $this->rolls[] = array(
        'notation' => $matches[0],
        'rolls' => $rolls
      );

    return "(" . implode(" + ", $rolls) . ")";
  }
private function _expand_equation($matches) {
    $rolls = array();

    for ( $i = 0; $i < $matches['count']; $i++ ) {
      $rolls[] = mt_rand(1, $matches['sides']);
    }

    // save individual roll results
    $this->rolls[] = array(
        'notation' => $matches[0],
        'rolls' => $rolls
      );

    return "(" . implode(" + ", $rolls) . ")";
  }
private function _expand_equation ( $ matches ) { $ rolls = array ( ) ; for ( $ i = 0 ; $ i < $ matches [ 'count' ] ; $ i ++ ) { $ rolls [ ] = mt_rand ( 1 , $ matches [ 'sides' ] ) ; } // save individual roll results $ this -> rolls [ ] = array ( 'notation' => $ matches [ 0 ] , 'rolls' => $ rolls ) ; return "(" . implode ( " + " , $ rolls ) . ")" ; }
Roll dice and expand the input into a matching equation

@param  string $matches Regex match
@return string          Replaced match
Roll dice and expand the input into a matching equation