-1

I am facing the following error:

PHP Parse error:  syntax error, unexpected '[', expecting ')'

The line of code throwing the error is:

$contents = str_replace(["\r\n","\r","\t","\n",'  ','    ','     '], '', $contents);

This PHP is within Magento 1.9. I am not familiar with PHP, so I wonder what this code is trying to do or why it would be throwing an error.

braaterAfrikaaner
  • 1,075
  • 8
  • 18

1 Answers1

2

Are you running this with a PHP version prior to 5.4? There did not know the short array syntax yet, so you have to write array(\r\n","\r","\t","\n",' ',' ',' ') instead

Nico Haase
  • 9,476
  • 35
  • 35
  • 57