Class 'NumberFormatter' did not find an error in a simple PHP program

I have a simple PHP program, but I am facing this error:

Class 'NumberFormatter' not found

I investigated similar problems in Stackoverflow, but honestly, no one gave a concrete solution. Others suggest updating the version of PHP, others do not comment on a specific line in the php.ini file, and none of them worked for me.

Below is my code: I even used the proposed solution from https://bugs.php.net , but it still does not work.

<!DOCTYPE html>
<html>
<body>

<?php
function writeMsg(){

$f = new \NumberFormatter("en", \NumberFormatter::SPELLOUT);    

echo $f->format(1432);
}
writeMsg();
?>  

</body>
</html>
+4
source share
1 answer

Two things

  • You need PHP 5.3 or higher.

  • You may not have the extension installed php-intl.

, :

php -m | grep intl

, , PHP

Mac, , PHP 5.6, :

brew install php56-intl

, - !

EDIT XAMPP:

XAMPP, , , , .

  • php.ini - -xampp/php/php.ini - .

  • php_intl. ;extension=php_intl.dll, - .

  • XAMPP!

+10

Source: https://habr.com/ru/post/1617105/


All Articles