title: syntax error, unexpected 'endforeach' (T_ENDFOREACH), expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF)
body: <p>Got a little problem with the php native here, here's the code</p>
  <pre class="lang-html prettyprint-override"><code>    &lt;?php foreach ($posts as $post): ?&gt;
      &lt;div class=&quot;post&quot; style=&quot;margin-left: 0px;&quot;&gt;
          &lt;img src=&quot;&lt;?php echo BASE_URL . '/static/images/' . $post['image']; ?&gt;&quot; class=&quot;post_image&quot; alt=&quot;&quot;&gt;
          &lt;!-- added if statement --&gt;
          &lt;?php if (isset($post['topic']['name'])): ?&gt;
          &lt;a href=&quot;&lt;?php echo BASE_URL . 'filteredposts.php?topic='. $post['topic']['id'] ?&gt;&quot;
          class= &quot;btn category&quot;&gt;
          &lt;?php echo $post['topic']['name'] ?&gt;
          &lt;/a&gt;
          &lt;/php endif ?&gt;
          &lt;a href=&quot;single_post.php?post-slug=&lt;?php echo $post['slug']; ?&gt;&quot;&gt;
              &lt;div class=&quot;post_info&quot;&gt;
                  &lt;h3&gt;&lt;?php echo $post['title'] ?&gt;&lt;/h3&gt;
                  &lt;div class=&quot;info&quot;&gt;
                      &lt;span&gt;&lt;?php echo date(&quot;F j, Y &quot;, strtotime($post[&quot;created_at&quot;])); ?&gt;&lt;/span&gt;
                      &lt;span class=&quot;read_more&quot;&gt;Read more...&lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/a&gt;
      &lt;/div&gt;
          &lt;?php endforeach; ?&gt;
          &lt;/div&gt;
  </code></pre>
  <p>Error:</p>
  <pre><code>Parse error: syntax error, unexpected 'endforeach' (T_ENDFOREACH), expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) 
  </code></pre>
  <p>any help will be appreciated, thanks guys.</p>