php - Verify if is in array in twig template -
i have question, it's possible make in_array in twig template? example have array call acolors colors of 1 product : array[ 0 => "1" 1 => "2" ] and have class in libraries folder : class colors{ public static $acolors = array( '1' => 'white', '2' => 'black', '3' => 'yellow', '4' => 'red', '5' => 'green', '6' => 'blue', ); } now want verify if values of array colors of product = keys of general array colors, , tried in .twig : {% key,val in acolors %} {% if val in colors::acolors %} {% endfor %} but not work. exist solution? please me. can me? thx in advance!!! twig not intended run php code in it. official position of twig developers: twig template engine , thing templating, doesn't know classes, static class properties , other php-only stuff. options have are: pass array context...