variable catenation

From: Date: Fri, 21 Feb 2003 18:13:11 +0000
Subject: variable catenation
Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-805@lists.php.net to get a copy of this message
I've been playing with variable catenation to see if it is even possible, and there are some problems. First, I was trying to resolve it for function attributes: {foobar foo=foo."bar" foo=$foo.$bar foo=$foo.bar} You can see there is a conflict of what "." means. Is $foo.bar a catenated value or an associative array? is $foo.$bar catenated or dynamic associative array? So then I decided to try "+" instead of ".", much like the javascript way of catenating strings. {foobar foo=foo+"bar" foo=$foo+bar foo="foo"+"bar"} Everything seems to work OK (even embedded + in quotes works as expected), you just can't put spaces around the + signs or else it is unclear where the next attribute starts. So, now moving on to IF statments. {if $foo+bar eq "blah" and 1+2=3} Another conflict, is + a string catenation operator or a math operator? I'd kind of like to stick to the PHP way of doing things with ".", except for the syntax conflicts... unless someone comes up with a good solution. Ideas? Othewise we go with the clunky cat modifier. Monte

« previous php.smarty.dev (#805) next »