I am writing a code to filter a bunch of gallery images using the tags assigned to the images. However I am running into this parse error
Parse error: syntax error, unexpected '}', expecting ',' or ';'
I am baffled coz I see that the "}" it is referring to has been opened and closed correctly. Any help would be greatly appreciated. This is the line thats throwing the error
<button class="cbp-filter-item"><?php if($key == 0){echo 'cbp-filter-item-active'};?> data-filter=".<?php echo strtolower(str_replace(" ","-",$tag)); ?>"><?php echo ucfirst($tag); ?></button> ","-",$tag)); ?>"><?php echo ucfirst($tag); ?></button>
Here's the code snippet >
<?php if(isset($tagsFilter) && count($tagsFilter)):
foreach($tagsFilter as $key=>$tag):
?>
<button class="cbp-filter-item"><?php if($key == 0){echo 'cbp-filter-item-active'};?> data-filter=".<?php echo strtolower(str_replace(" ","-",$tag)); ?>"><?php echo ucfirst($tag); ?></button>
<?php endforeach; endif;?>
</div>
<?php endif;?>
Any help would be greatly appreciated.
Thanks, Sai.