{max:val1:val2:...}

Description

Returns the largest of the supplied numbers. Give the values two ways: colon-separated (max:12:45:8) or as a single JSON array (max:[12,45,8]) - both yield the same result. Every value is parsed as a number: a decimal comma is read as a decimal point (1,5 means 1.5), surrounding spaces are ignored, and a non-numeric value counts as 0. With no values the result is empty; with one value that value is returned unchanged. The output is the raw number with no rounding - wrap it in round or number_format if you need fixed decimals. Sibling commands: min (smallest), avg (average).

Parameters

value1, value2, ... required

One or more numbers to compare. Pass them colon-separated (each value its own parameter) or as one JSON array. Values are read as numbers: a decimal comma becomes a decimal point, spaces are trimmed, and anything non-numeric counts as 0. With no values max returns empty; with exactly one value it returns that value unchanged.

Examples

test{max:12:45:8}
Expected45
Actual45
The basic form: list values separated by colons. Returns the largest.
test{math:{max:3.14159:2.5:9.876}:2}
Expected9.88
Actual9.88
A real-world combination: pick the largest value, then format it to two decimals with math. max returns the raw number (9.876); math rounds it to 9.88.
test{max:[12,45,8]}
Expected45
Actual45
The JSON-array form. Same result as the colon form - handy when the values already come from a JSON source.
test{max:45}
Expected45
Actual45
With exactly one value, that value is returned unchanged (nothing to compare).
test{max:-5:-20:-3}
Expected-3
Actual-3
Negative numbers work as expected: -3 is the largest (closest to zero).
test{max:3.14:2.71:9.99}
Expected9.99
Actual9.99
Decimal values compare numerically, not as text.
test{max:1,5:2,75}
Expected2.75
Actual2.75
A decimal comma is read as a decimal point (1,5 means 1.5), so 2,75 wins. The result prints with a dot.
test{max:7:abc:3}
Expected7
Actual7
A non-numeric value counts as 0. Here 7 is still the largest, so the result is 7 - but in an all-negative list a stray text value (=0) would win.
test{max:-5::-20}
Expected0
Actual0
A missing value between colons counts as 0 in the colon form. With all-negative numbers that 0 becomes the maximum - a common surprise.
test{max:[-5,"",-20]}
Expected-5
Actual-5
The JSON-array form drops empty strings before comparing, so the empty entry does not turn into 0. Contrast with the colon form above: here the result is -5, not 0.