src/Match.php
public function alphabet($pattern)
    {
        $s = array();
        foreach (preg_split("//u", $pattern, -1, PREG_SPLIT_NO_EMPTY) as $char) {
            $s[$char] = 0;
        }
        for ($i = 0; $i < mb_strlen($pattern); $i++) {
            $s[mb_substr($pattern, $i, 1)] |= 1 << (mb_strlen($pattern) - $i - 1);
        }
        return $s;
    }
public function alphabet($pattern)
    {
        $s = array();
        foreach (preg_split("//u", $pattern, -1, PREG_SPLIT_NO_EMPTY) as $char) {
            $s[$char] = 0;
        }
        for ($i = 0; $i < mb_strlen($pattern); $i++) {
            $s[mb_substr($pattern, $i, 1)] |= 1 << (mb_strlen($pattern) - $i - 1);
        }
        return $s;
    }
Initialise the alphabet for the Bitap algorithm.

@param string $pattern The text to encode.

@return array Hash of character locations.