It seems to look like my everything is ok but I don't know why it gives me this sort of error: Please Help me
Parse error: syntax error, unexpected '[' in /home/sites/xyz.com/public_html/wp-content/themes/abc/single-products.php on line 330
=============
Parse error: syntax error, unexpected '[' in /home/sites/xyz.com/public_html/wp-content/themes/abc/single-products.php on line 331
Here is my code :
<?php
$exclude = ['diffusion','twice-loved','antique-vintage'];
$tax_slugs = [];
foreach ($tax as $value) {
array_push($tax_slugs, $value->slug);
}
$intersect = count(array_intersect($exclude, $tax_slugs));
//if( $tax[0]->slug != 'diffusion'):
if($intersect === 0):
?>