call to undefined function mb_strimwidth

Yuri picture Yuri · Jan 10, 2013 · Viewed 22.9k times · Source

Months ago I made a short code that uses mb_strimwidth() to exactly fit some text into a table cell, putting dots at the end of a truncated string. Now, after some times, I tried to execute that same code and it went out with this error:

Fatal error: Call to undefined function mb_strimwidth() in ...

I tried to find the mbstring.php file, and when I found the mb_strimwidth() function, I discovered that it is not implemented anymore. How is that possible? But my main question is: how can I get the same result as mb_strimwidth()? I thought to rewrite the function using a loop and mb_strwidth(), but ALL the functions in that mbstring.php file are empty.

Answer

Michel Feldheim picture Michel Feldheim · Jan 10, 2013

All mb_* functions are provided by a PHP extension called Multibyte String, internal name mbstring

You probably don't have the extension active or installed. On most Linux distros you can install the package php-mbstring to install and activate this extension.

Apache needs to be restarted afterwards if you are using mod_php