How to get the width of a string in php?

For example:

the width of "English" = 7

the width of "中文" = 4

Is there a way to get the "width" of a string?

Update:

I know that in the UTF-8 encoding,

strlen("English") = 7
strlen("中文") = 6 

mb_strlen("English") = 7
mb_strlen("中文") = 2

I want the result of some function("中文") to be 4 . You see, the width of these two strings are equal:

word
中文

Solution 1:

After browsing all the functions starting with mb_ , I found this. It is exactly what I was looking for:

mb_strwidth()

It Returns the width of a string, where halfwidth characters count as 1, and fullwidth characters count as 2.

https://www.php.net/mb_strwidth