]>
Commit | Line | Data |
---|---|---|
4f5b44bd NL |
1 | --TEST-- |
2 | Twig supports binary operations (+, -, *, /, ~, %, and, or) | |
3 | --TEMPLATE-- | |
4 | {{ 1 + 1 }} | |
5 | {{ 2 - 1 }} | |
6 | {{ 2 * 2 }} | |
7 | {{ 2 / 2 }} | |
8 | {{ 3 % 2 }} | |
9 | {{ 1 and 1 }} | |
10 | {{ 1 and 0 }} | |
11 | {{ 0 and 1 }} | |
12 | {{ 0 and 0 }} | |
13 | {{ 1 or 1 }} | |
14 | {{ 1 or 0 }} | |
15 | {{ 0 or 1 }} | |
16 | {{ 0 or 0 }} | |
17 | {{ 0 or 1 and 0 }} | |
18 | {{ 1 or 0 and 1 }} | |
19 | {{ "foo" ~ "bar" }} | |
20 | {{ foo ~ "bar" }} | |
21 | {{ "foo" ~ bar }} | |
22 | {{ foo ~ bar }} | |
23 | {{ 20 // 7 }} | |
24 | --DATA-- | |
25 | return array('foo' => 'bar', 'bar' => 'foo') | |
26 | --EXPECT-- | |
27 | 2 | |
28 | 1 | |
29 | 4 | |
30 | 1 | |
31 | 1 | |
32 | 1 | |
33 | ||
34 | ||
35 | ||
36 | 1 | |
37 | 1 | |
38 | 1 | |
39 | ||
40 | ||
41 | 1 | |
42 | foobar | |
43 | barbar | |
44 | foofoo | |
45 | barfoo | |
46 | 2 |