Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine
Next Chapter

Challenge #1 of 2


Q: 

You just installed a bundle that provides price formatting, i.e. converts an integer 112499 number into a nice-looking price $1 124.99. You're too lazy to read the docs, so you ran the bin/console debug:twig command to find the new Twig filter, and the output of the command is:

Functions
---------

 * absolute_asset(path, packageName = null)
 * absolute_url(path)
 * asset(path, packageName)
 * asset_version(path, packageName)
 * dump()
 * min(value, values)
 * path(name, parameters, relative)

Filters
-------

 * capitalize
 * date(format = null, timezone = null)
 * default(default = "")
 * format_price(integerNumber, addDollarSignPrefix = false)
 * trans(arguments, domain, locale, count)
 * trim(characterMask = null, side = "both")
 * upper
 * url_encode

What is the correct way to convert the product.price property which represents the price as an integer number into the $1 124.99 format prefixing the price with the $ sign?

userVoice