-1

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):
?>
Cœur
  • 37,241
  • 25
  • 195
  • 267
alibaba
  • 61
  • 5
  • 1
    Is `$exclude` supposed to be an array? Have you read about how to create an array in PHP? – Dan May 06 '16 at 23:15

1 Answers1

0

PHP Arrays: http://php.net/manual/en/language.types.array.php

$exclude = array('diffusion','twice-loved','antique-vintage');
$tax_slugs = array();

...

jbrya029
  • 492
  • 3
  • 11