Edit on GitHub
Jump to docs navigation

Twig Components / Methods / scalar

Note: You are currently reading the documentation for Bolt 5.0. Looking for the documentation for Bolt 5.2 instead?

scalar is a Twig test to a value for being an scalar (integer, float, string or boolean, like is_scalar).

It uses the mentioned PHP functions / comparisons internally, so you have the same behavior as in PHP.

{% if somevar is scalar %} {# no equivalent in Twig %} #}
{% endif %}

Source: Squirrelphp



Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.