vendredi 27 novembre 2015

PHP -> NumberFormatter not working

I have php file test.php:

use App\Classes\test_class;

$xml = new DOMDocument( "1.0", "ISO-8859-15" );
echo 'DOMDocument-ok<br/>';

$formatter = new NumberFormatter('en_US', NumberFormatter::DECIMAL);
echo 'NumberFormatter-ok<br/>';
new test_class();

And test_class.php:

class test_class{

    public function __construct()
    {
        $xml = new \DOMDocument( "1.0", "ISO-8859-15" );
        echo 'DOMDocument-ok<br/>';

        $formatter = new \NumberFormatter('en_US', \NumberFormatter::DECIMAL);
        echo 'NumberFormatter-ok<br/>';
    }

}

When I run this code output is:

DOMDocument-ok
NumberFormatter-ok
DOMDocument-ok
NumberFormatter-ok

But in plugin "sebastian/money" when I use plugin I get this error "Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN) HELP Class 'NumberFormatter' not found"

For code:

<?php
namespace SebastianBergmann\Money;

use NumberFormatter;

class IntlFormatter implements Formatter
{
    private $numberFormatter;
    public function __construct($locale)
    {
        $this->numberFormatter = new NumberFormatter(
            $locale,
            NumberFormatter::CURRENCY
        );
    }

For line :

$this->numberFormatter = new NumberFormatter(
            $locale,
            NumberFormatter::CURRENCY
        );

EDITED:

Apparently NumberFormatter not working inside all Laravel app, but I don't know why, can someone help?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1Ny2gds
via IFTTT

Aucun commentaire:

Enregistrer un commentaire