function() { return 'custom'; }, 'custom_args' => function($v, $args) { return join(',', array_map(function($arg) use ($v) { return "$arg$v"; }, $args)); }, )); # build template $t = new Luigi\Template($template_str); $args = array( 'greet' => 'hello', 'name' => 'paul', 'count_0' => 0, 'count_1' => 1, 'count_10' => 10, ); # print results echo $t->run($args); # test static invocation echo Luigi\Template::run_once($template_str, $args);