cronFieldValues.php
Table of Contents
Functions
- cronFieldValues() : array<int, int>|null
- Expands one field of a cron expression into the values it matches.
Functions
cronFieldValues()
Expands one field of a cron expression into the values it matches.
cronFieldValues(string $field, int $min, int $max) : array<int, int>|null
Reads what a hand-written crontab holds: a star, a number, a range a-b, a step written with a
slash after a star or a range (*, 0-12 followed by / and the step), and any comma-separated
mix of those. A reader that handles only the first two silently misreads a six-hourly schedule
as a daily one.
Returns null rather than guessing: a value out of [$min, $max], a range written
backwards, a zero step, a name (mon, jan) or a preset (@daily) give null. A field that
cannot be read is a schedule whose promise is unknown, and a caller should say so rather than
take it for any particular schedule.
Parameters
- $field : string
-
The field, e.g.
*,3,1-5,0,30, or a step over a star or a range. - $min : int
-
The lowest legal value for this field (0 for minutes and hours, 1 for days of the month and months, 0 for days of the week).
- $max : int
-
The highest legal value for this field (59, 23, 31, 12, and 7 for days of the week, where both 0 and 7 are Sunday).
Tags
Return values
array<int, int>|null —The matching values, ascending and each once; null when the field cannot be read.