fenom-template / fenom

Template Engine for PHP. Maintainers wanted!
Other
446 stars 108 forks source link

Add string concationation #3

Closed bzick closed 11 years ago

bzick commented 11 years ago

Like

{"Timestamp: " ~ time() ~ " sec."} 
{* Timestamp: 1372053966 sec. *}
jakoch commented 11 years ago

Why do you use "~" and not simply "." as the concat-operator?

klkvsk commented 11 years ago

This is because "." is an array access operator in Fenom. "$a.$b" would be ambiguos.

jakoch commented 11 years ago

Ah, ok. This is inspired by Smarty, right? What about "+" as concat-op?

bzick commented 11 years ago

This is because "+" is an math operator. Bad situation: {$a + $b}, it is math-op or concat-op? For PHP it very important, because concatenation and math operations are different.

jakoch commented 11 years ago

One could detect the type of $a,$b and if string.. wait, this is odd, that implies lots of type checks. My idea is not good. You are probably right in using the ~.

What do you think about {$a .= $b} as an additional syntax?