LightnCandy option: FLAG_JSLENGTH

support {{foo.length}} when foo is an array (simulate JavaScript Array.proto.length behavior)

Sample Codes

The default behavior: foo.length do not look for Array.length.

Data:
array(
  "foo" => array(
    1,
    2,
    3
  ),
  "bar" => array(
    "length" => "go",
    "width" => 400
  )
)
Template:
{{foo.length}}, {{bar.length}}
Result:
, go
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo.length}}, {{bar.length}}";

$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => array(
    1,
    2,
    3
  ),
  "bar" => array(
    "length" => "go",
    "width" => 400
  )
);
echo $render($data);

foo.length will be Array.length.

Used option: FLAG_JSLENGTH

Data:
array(
  "foo" => array(
    1,
    2,
    3
  ),
  "bar" => array(
    "length" => "go",
    "width" => 400
  )
)
Template:
{{foo.length}}, {{bar.length}}
Result:
3, go
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo.length}}, {{bar.length}}";

$php = LightnCandy::compile($template, array(
  "flags" => LightnCandy::FLAG_JSLENGTH
));
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => array(
    1,
    2,
    3
  ),
  "bar" => array(
    "length" => "go",
    "width" => 400
  )
);
echo $render($data);