src/Carbon/CarbonPeriod.php
protected static function parseIso8601($iso)
    {
        $result = [];

        $interval = null;
        $start = null;
        $end = null;

        foreach (explode('/', $iso) as $key => $part) {
            if ($key === 0 && preg_match('/^R([0-9]*)$/', $part, $match)) {
                $parsed = strlen($match[1]) ? (int) $match[1] : null;
            } elseif ($interval === null && $parsed = CarbonInterval::make($part)) {
                $interval = $part;
            } elseif ($start === null && $parsed = Carbon::make($part)) {
                $start = $part;
            } elseif ($end === null && $parsed = Carbon::make(static::addMissingParts($start, $part))) {
                $end = $part;
            } else {
                throw new InvalidArgumentException("Invalid ISO 8601 specification: $iso.");
            }

            $result[] = $parsed;
        }

        return $result;
    }
protected static function parseIso8601($iso)
    {
        $result = [];

        $interval = null;
        $start = null;
        $end = null;

        foreach (explode('/', $iso) as $key => $part) {
            if ($key === 0 && preg_match('/^R([0-9]*)$/', $part, $match)) {
                $parsed = strlen($match[1]) ? (int) $match[1] : null;
            } elseif ($interval === null && $parsed = CarbonInterval::make($part)) {
                $interval = $part;
            } elseif ($start === null && $parsed = Carbon::make($part)) {
                $start = $part;
            } elseif ($end === null && $parsed = Carbon::make(static::addMissingParts($start, $part))) {
                $end = $part;
            } else {
                throw new InvalidArgumentException("Invalid ISO 8601 specification: $iso.");
            }

            $result[] = $parsed;
        }

        return $result;
    }
protected static function parseIso8601 ( $ iso ) { $ result = [ ] ; $ interval = null ; $ start = null ; $ end = null ; foreach ( explode ( '/' , $ iso ) as $ key => $ part ) { if ( $ key === 0 && preg_match ( '/^R([0-9]*)$/' , $ part , $ match ) ) { $ parsed = strlen ( $ match [ 1 ] ) ? ( int ) $ match [ 1 ] : null ; } elseif ( $ interval === null && $ parsed = CarbonInterval :: make ( $ part ) ) { $ interval = $ part ; } elseif ( $ start === null && $ parsed = Carbon :: make ( $ part ) ) { $ start = $ part ; } elseif ( $ end === null && $ parsed = Carbon :: make ( static :: addMissingParts ( $ start , $ part ) ) ) { $ end = $ part ; } else { throw new InvalidArgumentException ( "Invalid ISO 8601 specification: $iso." ) ; } $ result [ ] = $ parsed ; } return $ result ; }
Parse given ISO 8601 string into an array of arguments.

@param string $iso

@return array
Parse given ISO 8601 string into an array of arguments .