as you haven't mentioned where the array variable $_customerProductPrices
is from, whether its from a Block or from a ViewModel or in a template (.phtml file). As well as its also not mentioned how do you get this , whether through a repository method or from a collection or any other approach
Quick but Ugly
lets assume that its in a template file
in this case, loop through your array and get the variable formatted through this simple helper method
$priceFormatted = $this->helper('Magento\Framework\Pricing\Helper\Data')->currency(number_format($_customerProductPrices[$keyindex]['price'], 2), true, false);
Better Approach
Inside your class where you get this variable, inject the interface Magento/Framework/Pricing/PriceCurrencyInterface
and make use of the methods format
or convertAndFormat
public function format(
$amount,
$includeContainer = true,
$precision = self::DEFAULT_PRECISION,
$scope = null,
$currency = null
);
public function convertAndFormat(
$amount,
$includeContainer = true,
$precision = self::DEFAULT_PRECISION,
$scope = null,
$currency = null
);
These are the methods implemented by **Magento\Directory\Model\PriceCurrency**
you can also inject this class in your module class (Block / ViewModel) and make use of the format and convert methods in that concrete class
check the source here