$length = mb_strlen('Hello, world!', 'UTF-8'); // or whatever encoding