What I Need
i Need To convert country code to currency Symbol.
like for USD => $.
i Need to convert Currency code to currency symbol.
Code
controller
use Symfony\Component\Intl\ResourceBundle\CurrencyBundle;
class EventDetailController extends Controller
{
$currency = $data[0]['currency'];
$Currency= USD
Symfony\Component\Intl\Intl::getCurrencyBundle()->getCurrencySymbol('USD');
}
Error
PHP Fatal error: Class 'Acme\\biztradeshowsBundle\\Controller\\Symfony\\Component\\Intl\\Intl' not found in /home/indiamart/public_html/10into/src/Acme/biztradeshowsBundle/Controller/EventDetailController.php on line 180
You should write use
statement:
use Symfony\Component\Intl\ResourceBundle\CurrencyBundle;
use Symfony\Component\Intl\Intl;
class EventDetailController extends Controller
{
$currency = $data[0]['currency'];
$Currency= USD
Intl::getCurrencyBundle()->getCurrencySymbol('USD');
}
or write your FQCN with leading slash:
use Symfony\Component\Intl\ResourceBundle\CurrencyBundle;
class EventDetailController extends Controller
{
$currency = $data[0]['currency'];
$Currency= USD
\Symfony\Component\Intl\Intl::getCurrencyBundle()->getCurrencySymbol('USD');
}