We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Reverse order of the arguments in helper "format" in Volt

Hi, I have a question about helpers "format": I expected it to be used as "{{ (item.total_amount_uah/item.dollar_rate)|format('%.2f') }}" and turned you so "{{ '%.2f'|format(item.total_amount_uah/item.dollar_rate)}}", it is a mistake?

No it is a convention in Volt where the left operand of the pipe ('|') operator is the first argument of the related php function. Format uses sprintf, and the 1st sprintf argument is the string format, so that the left operand of the pipe is the format.



644

Ok, thank.