Test file
back to index
math
numeric comparison
Apache comparison is normally string comparison, so 20 > 100, this is numeric comparison to counter that.
Directives
- <!--#func var="fred" func="cmp" a="-1" op="eq" b="2" --><!--#echo var="fred" -->
- <!--#func var="fred" func="cmp" a="-1" op="ne" b="2" --><!--#echo var="fred" -->
- <!--#func var="fred" func="cmp" a="-1" op="lt" b="2" --><!--#echo var="fred" -->
- <!--#func var="fred" func="cmp" a="-1" op="gt" b="2" --><!--#echo var="fred" -->
- <!--#func var="fred" func="cmp" a="-1" op="le" b="2" --><!--#echo var="fred" -->
- <!--#func var="fred" func="cmp" a="-1" op="ge" b="2" --><!--#echo var="fred" -->
Results
- 0
- 1
- 1
- 0
- 1
- 0
Negative of a value
Directive
<!--#func var="fred" func="neg" value="-1" --><!--#echo var="fred" -->
Result
1
Multiplication
Directive
<!--#func var="fred" func="mult" value="-16" value="-3" --><!--#echo var="fred" -->
Result
48
Division
Only gives whole number results
Directive
<!--#func var="fred" func="div" value="-16" value="3" --><!--#echo var="fred" -->
Result
-5
Modulo Division
Gives the remainder of the division
Directive
<!--#func var="fred" func="mod" value="30" value="-16" --><!--#echo var="fred" -->
Result
14
Numeric Addition
Directive
<!--#func var="fred" func="add" value="-16" value="3" --><!--#echo var="fred" -->
Result
-13