Ahi ya no me salio ese error, que tarado nunca me fije al fecha ya actualice la version del Twig que tenia pero ahora nose como mandar la funcion mediante el array:
Código PHP:
<?php
require_once 'Twig/Autoloader.php';
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array(
'cache' => 'cache',
'debug' => 'true'));
/*-----*/
$function = new Twig_SimpleFunction('fnx_asd', function () {
return 'La funcion salio bien!!';
});
$twig->addFunction($function);
/*-----*/
$template = $twig->loadTemplate('index.twig.html');
echo $template->render(array(
'variable' => 'Hola mundo!',
));