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

Integer to string

HI all,

how can i pass an int to a template? VOLT converts it to a string and numeric comparisons fails without a type casting. Is there any workaround?

Thanks



8.1k
Accepted
answer

You can define user function in Volt for any conversion of your data. https://docs.phalcon.io/en/latest/reference/volt.html#id3



20.4k

Thanks for your answer! Is this the expected behaviour? Why?



8.1k

Volt - extensible compiler. It has any standard functions, and you can extend it with any function.