We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

format modifier howto

Hello,

I need to write

sprintf('%010s', $invoiceFlat->invoiceInc)

in volt. How to use format modifier?



58.4k
edited Oct '14

Hey man

You must to defind function php in volt, for example

[...]
$compiler = $volt->getCompiler();

 $compiler->addFunction('sprintf', 'sprintf');

Also you refer setup function of volt here

It worked! :) Thank you. Here is my example.

{{ ('%0'~society.invoicePad~'s')|format(invoiceFlat.invoiceInc) }}