column
¶
The column
filter returns the values from a single column in the input
array.
列フィルターは、inputarray 内の 1 つの列から値を返します。
1 2 3 4 5 |
{% set items = [{ 'fruit' : 'apple'}, {'fruit' : 'orange' }] %}
{% set fruits = items|column('fruit') %}
{# fruits now contains ['apple', 'orange'] #}
|
Note
ノート
Internally, Twig uses the PHP array_column function.
内部的に、Twig は PHP の array_column 関数を使用します。
Arguments ¶
name
: The column name to extractname: 抽出する列名