Fatal error: Class 'NumberFormatter' not found
P粉817354783
P粉817354783 2023-08-16 16:29:06
0
2
477

I've been using this exact same code for ages and never had any problems. Suddenly it stopped working.

I read about this problem on the internet and apparently you need to install PHP 5.3 or higher, as well as install the PHP intl plugin. I have both, but whenever I use the function below I still get a Fatal Error: Not found error for class 'NumberFormatter':

function format_item($value) { $format = new NumberFormatter('en_US', NumberFormatter::CURRENCY); return $format->formatCurrency($value, 'AUD'); }

Also, here is part of my php.ini file showing that I have the PHP intl plugin installed:

[intl] intl.default_locale = fr_FR ; This directive allows you to produce PHP errors when some error ; happens within intl functions. The value is the level of the error produced. ; Default is 0, which does not produce any errors. intl.error_level = E_WARNING

I also added extension=php_intl.dll in my php.ini and it is also in my directory.

Why am I getting this error?

P粉817354783
P粉817354783

reply all (2)
P粉409742142

What you need is:

apt-get install php7.0-intl

No need to change php.ini or do anything else. (Tested on Ubuntu 16.04 with PHP 7).

The most popular answer here is to have you uncomment a .dll file, which will never solve anything unless you are on a Windows server!

    P粉237029457

    This seems to be a very strange problem, I solved it by:

    I upgraded my PHP in Wamp throughthistutorial. I also updated the time zone settings inphp.ini. When I upgraded it didn't work so I reverted back to the previous PHP version and the problem was solved.

    I have absolutely no idea why this solves the problem, but it works for me.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!