simple math
| From: | Monte Ohrt | Date: | Fri, 02 May 2003 16:48:06 +0000 |
| Subject: | simple math | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-1316@lists.php.net to get a copy of this message | ||
As an experiment :-) I committed simple math operators on variables.
examples:
{$var}
{$var+1}
{$var-1}
{$var*2}
{$var/4}
{$var++}
{$var--}
{$var+3.45}
It can be put on the end of any valid varname:
{#var#+1}
{$var[foo].bar+1}
{$obj->foo+1}
Realize that $var++ increments the variable _after_ displayed. Also,
there is no checking the validity of $var, so putting $var++ on a string
is the same as $var++ on a string in PHP.
We'll see if this causes any problems, but it look pretty harmless. I
know this is another double-edge sword thing... it is very handy,
but also opens doors for template abuse.
I'd like thoughts on it, try it out.
Monte