0

I have enabled mbstring in my php.ini.It even shows in phpinfo().But still I am getting this error in yii2.

PHP Fatal Error 'yii\base\ErrorException' with message 'Call to undefined function yii\helpers\mb_strlen()
user2431224
  • 235
  • 3
  • 15

1 Answers1

1

As @TomaszKane said in comment, mb_strlen() is native PHP function, so you need to call it as mbstrlen() without specifying the namespace.

Official documentation:

Also take a look at yii\helpers\StringHelper, mb_strlen() is used in several places. For example, if you are looking for byte length, there is special method byteLength(), you can call it like that:

use yii\helpers\StringHelper;

...

StringHelper::byteLength($string);

It's basically syntactic sugar of mb_strlen().

arogachev
  • 33,150
  • 7
  • 114
  • 117
  • Yes it is used in byteLength() thats why its throwing error.I am not using it anywhere ,error is in the base file of yii2 i.e.StringHelper. – user2431224 Aug 06 '15 at 08:57