private function _rewritepages($pagesParam) {
        $pages = str_replace(' ', '', $pagesParam);
        $part = explode(',', $pages);

        //parse hyphens
        foreach ($part as $i) {
            $ind = explode('-', $i);

            if (count($ind) == 2) {
                $x = $ind[0]; //start page
                $y = $ind[1]; //end page

                if ($x > $y) {
                    throw new Exception("Starting page, '$x' is greater than ending page '$y'.");
                    return false;
                }

                //add middle pages
                while ($x <= $y) {
                    $newpages[] = (int) $x;
                    $x++;
                }
            } else {
                $newpages[] = (int) $ind[0];
            }
        }
        return $newpages;
    }
private function _rewritepages($pagesParam) {
        $pages = str_replace(' ', '', $pagesParam);
        $part = explode(',', $pages);

        //parse hyphens
        foreach ($part as $i) {
            $ind = explode('-', $i);

            if (count($ind) == 2) {
                $x = $ind[0]; //start page
                $y = $ind[1]; //end page

                if ($x > $y) {
                    throw new Exception("Starting page, '$x' is greater than ending page '$y'.");
                    return false;
                }

                //add middle pages
                while ($x <= $y) {
                    $newpages[] = (int) $x;
                    $x++;
                }
            } else {
                $newpages[] = (int) $ind[0];
            }
        }
        return $newpages;
    }
private function _rewritepages ( $ pagesParam ) { $ pages = str_replace ( ' ' , '' , $ pagesParam ) ; $ part = explode ( ',' , $ pages ) ; //parse hyphens foreach ( $ part as $ i ) { $ ind = explode ( '-' , $ i ) ; if ( count ( $ ind ) == 2 ) { $ x = $ ind [ 0 ] ; //start page $ y = $ ind [ 1 ] ; //end page if ( $ x > $ y ) { throw new Exception ( "Starting page, '$x' is greater than ending page '$y'." ) ; return false ; } //add middle pages while ( $ x <= $ y ) { $ newpages [ ] = ( int ) $ x ; $ x ++ ; } } else { $ newpages [ ] = ( int ) $ ind [ 0 ] ; } } return $ newpages ; }
Takes our provided pages in the form of 1,3,4,16-50 and creates an array of all pages
@param $pages
@return unknown_type
Takes our provided pages in the form of 1 3 4 16 - 50 and creates an array of all pages