From 1df7761e1aed7b3551ea107a5f932cac8c23c66f Mon Sep 17 00:00:00 2001 From: "pabs@pablotron.org" Date: Wed, 17 Dec 2014 23:42:10 -0500 Subject: add php --- php/template-test.php | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 php/template-test.php (limited to 'php/template-test.php') diff --git a/php/template-test.php b/php/template-test.php new file mode 100644 index 0000000..e7d5587 --- /dev/null +++ b/php/template-test.php @@ -0,0 +1,64 @@ + 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); -- cgit v1.2.3