I am currently writing a PHP function but when the complete script is executed I am getting an error:
Error:
Call to undefined function mb_convert_encoding()
My function:
function cleanData(&$str)
{
if($str == 't') $str = 'TRUE';
if($str == 'f') $str = 'FALSE';
if(preg_match("/^0/", $str) || preg_match("/^\+?\d{8,}$/", $str) || preg_match("/^\d{4}.\d{1,2}.\d{1,2}/", $str)) {
$str = "'$str";
}
if(strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"';
$str = mb_convert_encoding($str, 'ISO-8859-1','utf-8');
}
Can anyone see where I am going wrong. Many thanks in advance for your time.
Cheers
You need to install the extension. It depends on of your operating system, here are some examples:
sudo apt-get install php-mbstring # Debian, Ubuntu
sudo yum install php-mbstring # RedHat, Fedora, CentOS
On Windows, uncomment the following line in php.ini
, and restart the Apache server:
extension=mbstring
If you still get the error afterwards, make sure that what you see is not cached response.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With