PHP 8.5.0 Alpha 4 available for testing

Voting

: two plus five?
(Example: nine)

The Note You're Voting On

Ben
16 years ago
If you find yourself without the mb string functions and can't easily change it, a quick hack replacement for mb_strlen for utf8 characters is to use a a PCRE regex with utf8 turned on.

$strlen = preg_match_all("/.{1}/us",$utf8string,$dummy);

This is basically an ugly hack which counts all single character matches, and I'd expect it to be painfully slow on large strings.

<< Back to user notes page

To Top