mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
c76f5c8be0
Add more docs
957 B
957 B
Operators
Math
Operators: + - / *
{$a + $b * $c/$d - $e*5 + 1e3}
Boolean
Operators: || && and or < > <= >= == === !== !=
{if $a && $b >= 5 && $c != 3} {/if}
Bitwize
Operators: | & << >> |= &= <<= >>=
{if $a & 1} {var $b |= $flags} {/if}
Unary
Operators: ^ ~ - !
{var $b |= $flags & ^$c}
Ternar
Operators: ? :
{var $a = true}
{$a ? 5 : 10} {* outputs 5 *}
{var $a = false}
{$a ? 5 : 10} {* outputs 10 *}
Variable operator
Checking variable value
{if $a?} {* instead of {if !empty($a)} *}
Checking variable existence
{if $a!} {* instead of {if isset($a)} *}
Get default if variable is empty
{$a?:"some text"} {* instead of {if empty($a) ? "some text" : $a} *}
Get default if variable doesn't exist
{$a!:"some text"} {* instead of {if isset($a) ? $a : "some text"} *}