Callable

Justin Hileman edited this page May 22, 2013 · 6 revisions

In Mustache.php, a variable is considered "callable" if the variable is:

  1. an anonymous function.
  2. an object and the name of a public function, e.g. array($someObject, 'methodName').
  3. a class name and the name of a public static function, e.g. array('SomeClass', 'methodName').
  4. an instance of a class which implements __invoke (PHP 5.4+).

strict_callables

As of v2.2.0, the Mustache Engine accepts a strict_callables option, which defaults to false. If set, Mustache will only consider the following as "callable":

  1. an anonymous function.
  2. an instance of a class which implements __invoke (PHP 5.4+).

Enabling strict_callables is recommended for anyone using PHP 5.3 or better.