function parseExpr($expr) {
        $parts=array();
        if (preg_match('/^@(\w+)$/',$expr,$m)) {
            if (!isset($this->presets[$m[1]]))
                return FALSE;
            $expr=$this->presets[$m[1]];
        }
        $expr=preg_split('/\s+/',$expr,-1,PREG_SPLIT_NO_EMPTY);
        $ranges=array(
            0=>59,//minute
            1=>23,//hour
            2=>31,//day of month
            3=>12,//month
            4=>6,//day of week
        );
        foreach($ranges as $i=>$max)
            if (isset($expr[$i]) && preg_match_all('/(?<=,|^)\h*(?:(\d+)(?:-(\d+))?|(\*))(?:\/(\d+))?\h*(?=,|$)/',
                    $expr[$i],$matches,PREG_SET_ORDER)) {
                $parts[$i]=array();
                foreach($matches as $m) {
                    if (!$range=@range(@$m[3]?0:$m[1],@$m[3]?$max:(@$m[2]?:$m[1]),@$m[4]?:1))
                        return FALSE;//step exceeds specified range
                    $parts[$i]=array_merge($parts[$i],$range);
                }
            } else
                return FALSE;
        return $parts;
    }
function parseExpr($expr) {
        $parts=array();
        if (preg_match('/^@(\w+)$/',$expr,$m)) {
            if (!isset($this->presets[$m[1]]))
                return FALSE;
            $expr=$this->presets[$m[1]];
        }
        $expr=preg_split('/\s+/',$expr,-1,PREG_SPLIT_NO_EMPTY);
        $ranges=array(
            0=>59,//minute
            1=>23,//hour
            2=>31,//day of month
            3=>12,//month
            4=>6,//day of week
        );
        foreach($ranges as $i=>$max)
            if (isset($expr[$i]) && preg_match_all('/(?<=,|^)\h*(?:(\d+)(?:-(\d+))?|(\*))(?:\/(\d+))?\h*(?=,|$)/',
                    $expr[$i],$matches,PREG_SET_ORDER)) {
                $parts[$i]=array();
                foreach($matches as $m) {
                    if (!$range=@range(@$m[3]?0:$m[1],@$m[3]?$max:(@$m[2]?:$m[1]),@$m[4]?:1))
                        return FALSE;//step exceeds specified range
                    $parts[$i]=array_merge($parts[$i],$range);
                }
            } else
                return FALSE;
        return $parts;
    }
function parseExpr ( $ expr ) { $ parts = array ( ) ; if ( preg_match ( '/^@(\w+)$/' , $ expr , $ m ) ) { if ( ! isset ( $ this -> presets [ $ m [ 1 ] ] ) ) return FALSE ; $ expr = $ this -> presets [ $ m [ 1 ] ] ; } $ expr = preg_split ( '/\s+/' , $ expr , - 1 , PREG_SPLIT_NO_EMPTY ) ; $ ranges = array ( 0 => 59 , //minute 1 => 23 , //hour 2 => 31 , //day of month 3 => 12 , //month 4 => 6 , //day of week ) ; foreach ( $ ranges as $ i => $ max ) if ( isset ( $ expr [ $ i ] ) && preg_match_all ( '/(?<=,|^)\h*(?:(\d+)(?:-(\d+))?|(\*))(?:\/(\d+))?\h*(?=,|$)/' , $ expr [ $ i ] , $ matches , PREG_SET_ORDER ) ) { $ parts [ $ i ] = array ( ) ; foreach ( $ matches as $ m ) { if ( ! $ range = @ range ( @ $ m [ 3 ] ? 0 : $ m [ 1 ] , @ $ m [ 3 ] ? $ max : ( @ $ m [ 2 ] ? : $ m [ 1 ] ) , @ $ m [ 4 ] ? : 1 ) ) return FALSE ; //step exceeds specified range $ parts [ $ i ] = array_merge ( $ parts [ $ i ] , $ range ) ; } } else return FALSE ; return $ parts ; }
Parse a cron expression
@param string $expr
@return array|FALSE
Parse a cron expression