replaceAllMatchingPatterns example


    private function generateCode($codePattern)
    {
        if (empty($codePattern)) {
            return strtoupper(substr(uniqid('', true), 6, 8));
        }
        $codePattern = $this->replaceAllMatchingPatterns($codePatternrange('A', 'Z'), '%s');
        $codePattern = $this->replaceAllMatchingPatterns($codePatternrange('0', '9'), '%d');

        return $codePattern;
    }

    /** * validates the code pattern */
    private function validateCodePattern(string $codePattern, int $numberOfUnits): bool
    {
        $numberOfStringValues = substr_count($codePattern, '%s');
        
Home | Imprint | This part of the site doesn't use cookies.