PHP code example of dpolac / twig-lambda

1. Go to this page and download the library: Download dpolac/twig-lambda library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dpolac / twig-lambda example snippets


$twig->addExtension(new \DPolac\TwigLambda\LambdaExtension());
twig
{{ [1, 2, 3] is any(=> _ is even) ? "There is even element in the array." }}
{# prints 'There is even element in the array.' #}
twig
{{ [1, 2, 3] is every(=> _ > 0) ? "All elements in the array are positive." }}
{# prints 'All elements in the array are positive.' #}