PHP 7.4 introduced mb_str_split(), which roughly do the same than our for loop in OmniString::getBigrams code.
That means:
public function getBigrams () { $bigrams = []; $len = $this->len(); for ($i = 0 ; $i < $len - 1 ; $i++) { $bigrams[] = mb_substr($this->value, $i, 2, $this->encoding); } return $bigrams; }
Could in PHP 7.4+ rewritten as:
public function getBigrams () { return mb_str_split($this->value, 2, $this->encoding); }
Reference: https://wiki.php.net/rfc/mb_str_split