Oihana PHP Standards

isIso8601Recurrence.php

Table of Contents

Functions

isIso8601Recurrence()  : bool
Validates whether a string is a valid ISO 8601 recurring interval.

Functions

isIso8601Recurrence()

Validates whether a string is a valid ISO 8601 recurring interval.

isIso8601Recurrence(string $value) : bool

The format is R[n]/<interval> where:

  • R is the recurrence designator (required)
  • n is an optional non-negative integer count (absent means infinite)
  • <interval> is any valid ISO 8601 bounded interval — see isIso8601Interval()
Parameters
$value : string

The recurrence string to validate

Tags
example
isIso8601Recurrence('R/2026-05-14T00:00:00Z/P1D');     // true (infinite)
isIso8601Recurrence('R5/2026-05-14T00:00:00Z/P1D');    // true (5 occurrences)
isIso8601Recurrence('R0/2026-05-14T00:00:00Z/PT0S');   // true (zero, degenerate)
isIso8601Recurrence('R10/P1D/2026-05-15T00:00:00Z');   // true
isIso8601Recurrence('2026-05-14T00:00:00Z/P1D');       // false (missing R)
isIso8601Recurrence('R-1/P1D/2026-05-15T00:00:00Z');   // false (negative count)
isIso8601Recurrence('R/P1D');                          // false (interval must be bounded)
link

ISO 8601 Repeating intervals

author

Marc Alcaraz (ekameleon)

since
1.0.2
Return values
bool

True if the string is a valid ISO 8601 recurrence, false otherwise

On this page

Search results