Wordpress数组不起作用[重复]

This question already has an answer here:

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):
?>
</div>

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

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

...