How can I get the length of string that also contains character references? I want to count only the number of characters which will be displayed in the browser. Like
$raw = "Stack�f9" = Length = 6
$raw = "Stack12345" = Length = 10
$raw = "Stack�f9�f9" = Length = 7
Thanks in advance
I would go with:
Although I would first question why you have HTML entities inside your strings, as opposed to manipulating actual UTF-8 encoded strings.
Also, be careful in that your HTML entities are not correctly written (they need to end with a semicolon). If you do not add the semicolon, any entity-related functions will fail, and many browsers will fail to render your entities correctly.