Multiply template variable |
I want to multiply a codeigniter template variable by 1000.
This doesn't work `{myVar * 1000}` or this `{myVar*1000}` and definitely not `{myVar}*1000` How can I do it. (06-17-2020, 09:58 AM)php_rocs Wrote: @Ceo,CI4. If i try {myVat * 1000} it just plainly shows `{myVar *1000} without rendering it Thanks so much for replying
06-17-2020, 11:57 AM
(This post was last modified: 06-17-2020, 12:02 PM by Digital_Wolf. Edit Reason: Fixed syntax types ) (06-17-2020, 10:03 AM)Ceo Wrote:(06-17-2020, 09:58 AM)php_rocs Wrote: @Ceo,CI4. Well, in the end, it outputs correctly, because you are just trying to change the template itself, and not perform an operation on it ... In general, you just need to move the multiplication operator out of curly braces, like this: {myVar} * 1000, and if myVar is a string containing at least one digit, php will try to convert it to a number. More on this here: type-juggling p.s. Sorry my English :~ I would change this world, but God doesn't give me the source.
|
Welcome Guest, Not a member yet? Register Sign In |