You are right, Volt does not support bitwise operators. One way to solve the problem is to create your functions when declaring voltService:
$di->setShared('view', function() { $view = new \Phalcon\Mvc\View(); $view->registerEngines(array( '.volt' => 'voltService' )); return $view; }); $di->set('voltService', function ($view, $di) { // ... $volt = new Phalcon\Mvc\View\Engine\Volt($view, $di); // ... $compiler = $volt->getCompiler(); $compiler->addFunction('bit_and', function($resolvedArgs, $exprArgs) use ($compiler) { return sprintf( '(%s & %s)', $compiler->expression($exprArgs[0]['expr']), $compiler->expression($exprArgs[1]['expr']) ); }); return $volt; });
for use as a function in a Volt template
{% if bit_and(2, keyword.getFlags()) %} checked="checked" {% endif %}
source share