title: Handlebars PHP implementation and nested if/else issues
body: <p>I'm using the Handlebars <strong>PHP</strong> implementation from <a href="https://github.com/XaminProject/handlebars.php" rel="nofollow">https://github.com/XaminProject/handlebars.php</a></p>
  
  <p>In a Handlebars template I'm using a nested <code>if/else</code>, see the template below:</p>
  
  <pre><code> &lt;div class="text-align-{{ options.alignment }} border-bottom-{{ options.style }}" style="border-width: {{ options.width }}px; border-color: {{ options.color }}"&gt;
      {{#if options.use_title_separator}}
          &lt;div&gt;
              {{#if options.back_to_top}}
                  &lt;a href="" onclick="return false;"&gt;{{ options.text_label }}&lt;/a&gt;
              {{else}}
                  {{ options.text_label }}
              {{/if}}
          &lt;/div&gt;
      {{/if}}
  &lt;/div&gt;
  </code></pre>
  
  <p>which is working ok in a <strong>PHP 5.4</strong> installation but in a <strong>PHP 5.2</strong> installation it throws the following error:</p>
  
  <pre><code>&lt;b&gt;Parse error&lt;/b&gt;: syntax error, unexpected T_FUNCTION in &lt;b&gt;/.../Handlebars/Helpers.php&lt;/b&gt; on line &lt;b&gt;71&lt;/b&gt;&lt;br /&gt;
  </code></pre>
  
  <p>The conflictive code seems to be:</p>
  
  <pre><code>$this-&gt;add(
          'if', 
          function ($template, $context, $args, $source) {
              $tmp = $context-&gt;get($args);
              $buffer = '';
  
              if ($tmp) {
                  $template-&gt;setStopToken('else');
                  $buffer = $template-&gt;render($context);
                  $template-&gt;setStopToken(false);
                  $template-&gt;discard($context);
              } else {
                  $template-&gt;setStopToken('else');
                  $template-&gt;discard($context);
                  $template-&gt;setStopToken(false);
                  $buffer = $template-&gt;render($context);
              }
              return $buffer;
          }
      );
  </code></pre>
  
  <p>I'm a complete <strong>PHP</strong> noob and I'm just using this Handelbars PHP implementation to have the same templates across several varios environments.</p>
  
  <p>Can you help me to fix this issue?</p>
  
  <p>Thanks</p>