Methods for handling multibyte string manipulations.
via composer:
composer require jpuck/mbstring
See the tests for more examples.
Creates an index of uppercase character positions in a string that can be mapped to other strings.
$original = '🔥 Foó, foó FOÓ 😁';
$casemap = new CaseMap($original);
$replaced = mb_eregi_replace('foó', 'bår', $original);
$restored = $casemap->transform($replaced);
echo "original: $original\n";
echo "replaced: $replaced\n";
echo "restored: $restored\n";
original: 🔥 Foó, foó FOÓ 😁 replaced: 🔥 bår, bår bår 😁 restored: 🔥 Bår, bår BÅR 😁