Accessing value of iterated field in Mustache PHP

The implicit Iterator is the way to go for simple data. If your data is more complex then PHPs ArrayIterator does the job well.

Here is an example that I have working. Hope it is useful for somebody else.

$simple_data = array('value1','value2','value3');   
$complex_data = array(array('id'=>'1','name'=>'Jane'),array('id'=>'2','name'=>'Fred') );

$template_data['simple'] = $simple_data;
$template_data['complex'] = new ArrayIterator( $complex_data ); 

$mustache->render('template_name', $template_data );

And in the template you could have

{{#simple}}
      {{.}}<br />
{{/simple}}

{{#complex}}
   <p>{{ id }} <strong>{{ name }}</strong></p>
{{/complex}}

You can use the implicit iterator feature of mustache for this:

https://github.com/bobthecow/mustache.php/tree/master/examples/implicit_iterator

{{#values}}
    {{.}}
{{/values}}

Your original array probably needs numeric keys and now string though. It might work that way, but I haven't tested it.