tags:

views:

85

answers:

1

Hi,

I need to test if two variables are equals. But one is in string format and the other is a number.

So, I try to convert the variable in text, but without success.

Have you an idea ?

A: 

Try using {$number|string_format:"%.2f"} to convert both numbers to strings and compare them. or {$number|string_format:"%d"} if it are integer, instead of float numbers.

I don't see a way in smarty to explicitly cast a sting to an integer, so you should convert both to a string.

If it doesn't work, please post your code. Maybe the issue lies in a different line..

JochenJung