Twig

灵活、快速且安全的
PHP 模板引擎

a Symfony Product
您正在阅读 Twig 3.x 的文档。切换到 Twig 1.x, 2.x 的文档。

问题和反馈

许可证

Twig 文档 基于新的 BSD 许可证 获得许可。

max

max 返回序列或一组值中的最大值

1
2
{{ max(1, 3, 2) }}
{{ max([1, 3, 2]) }}

当使用映射调用时,max 会忽略键,仅比较值

1
2
{{ max({2: "e", 1: "a", 3: "b", 5: "d", 4: "c"}) }}
{# returns "e" #}