Re: [SMARTY] Comparing numbers

From: Date: Tue, 06 Apr 2004 14:07:10 +0000
Subject: Re: [SMARTY] Comparing numbers
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11236@lists.php.net to get a copy of this message
Erich Beyrent wrote:
Hi there, I have a need to compare two numbers, and if one is greater than the other, output some stuff. In this example, {$Events[i].monthnum} = 03
                {$Month} = 04
{if $Events[i].monthnum > $Month} do stuff here {/if} This fails. So thinking it was perhaps the leading zero, I tried the following, which failed equally:
In case of the obvious, 3 > 4 should fail (false).
{if $Events[i].monthnum|regex_replace:"/^0/":" " > $Month|regex_replace:"/^0/":" "} So, then I tried: {if $Events[i].monthnum|string_format:"%d" > $Month|string_format:"%d"} And this fails too. So now I am really stumped. Any tips? My Smarty version is 2.3.1. -Erich-


« previous php.smarty.general (#11236) next »