src/includes/classes/Core/Utils/Name.php
public function toAcronym(string $name, bool $strict = true): string
    {
        $acronym = ''; // Initialize.

        $name = $this->stripClean($name);
        $name = $this->c::forceAscii($name);

        $name = preg_replace('/([a-z])([A-Z0-9])/u', '${1} ${2}', $name);
        $name = preg_replace('/([a-z])([0-9])/ui', '${1} ${2}', $name);
        $name = preg_replace('/([0-9])([a-z])/ui', '${1} ${2}', $name);
        // `s2` = `s 2`, `S3` = `S 3`, `3s` = `3 s`, `xCache` = `x Cache`.

        foreach (preg_split('/\s+/u', $name, -1, PREG_SPLIT_NO_EMPTY) as $_word) {
            if (isset($_word[0]) && ctype_alnum($_word[0])) {
                $acronym .= $_word[0];
            }
        } // unset($_word);

        if ($strict && mb_strlen($acronym) < 2) {
            $acronym = $this->c::mbStrPad(mb_substr($acronym, 0, 2), 2, 'x');
        }
        return mb_strtoupper($acronym);
    }
public function toAcronym(string $name, bool $strict = true): string
    {
        $acronym = ''; // Initialize.

        $name = $this->stripClean($name);
        $name = $this->c::forceAscii($name);

        $name = preg_replace('/([a-z])([A-Z0-9])/u', '${1} ${2}', $name);
        $name = preg_replace('/([a-z])([0-9])/ui', '${1} ${2}', $name);
        $name = preg_replace('/([0-9])([a-z])/ui', '${1} ${2}', $name);
        // `s2` = `s 2`, `S3` = `S 3`, `3s` = `3 s`, `xCache` = `x Cache`.

        foreach (preg_split('/\s+/u', $name, -1, PREG_SPLIT_NO_EMPTY) as $_word) {
            if (isset($_word[0]) && ctype_alnum($_word[0])) {
                $acronym .= $_word[0];
            }
        } // unset($_word);

        if ($strict && mb_strlen($acronym) < 2) {
            $acronym = $this->c::mbStrPad(mb_substr($acronym, 0, 2), 2, 'x');
        }
        return mb_strtoupper($acronym);
    }
Convert name to acronym.

@since 160220 Initial release.

@param string $name   Full name.
@param bool   $strict Strict?

@return string Acronym; based on name.