Block file : -
namespace Test\Module\Block;
class Product extends \Magento\Framework\View\Element\Template
{
protected $priceHelper;
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Pricing\Helper\Data $priceHelper
) {
$this->priceHelper = $priceHelper;
parent::__construct($context);
}
public function getFormattedPrice($price)
{
return $this->priceHelper->currency($price, true, false);
}
}
PHTML file :
$price = $this->getFormattedPrice(200);
echo $price;