0

I was trying to move my website to my new server. But after I moved the code and wanted to run the website, I got this php error:

PHP Parse error:  syntax error, unexpected ''] = "'' (T_CONSTANT_ENCAPSED_STRING), expecting ']' in /home/mywebsite/public_html/includes/functions/functions_general.php on line 1230

Here is the code on line 1230:

$trans_table['''] = "'";

The strange thing is that this error was never reported on my old server. Could someone help?

Thank you.

user229044
  • 232,980
  • 40
  • 330
  • 338
user2926814
  • 145
  • 6

5 Answers5

0

There are three single quotes characters inside the [], you should use double quotes for array index, instead of single quotes.

Klaus
  • 451
  • 5
  • 8
0

use " " instead of ' '

$trans_table["'"] = "'";

You are using [singlequote singlequote singlequote] instead use [doublequote singlequote doublequote]

aWebDeveloper
  • 36,687
  • 39
  • 170
  • 242
0

I suppose that you probably have had different strictness settings for your PHP on old server. In there the error isn't reported and execution has continued. The error seems to be quite obvious, though:

$trans_table['''] = "'";

becomes

$trans_table['''] = "'";

The part between [] has three ' in it after the ' is interpret as '. Use "" instead around it and should work.

Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66
0

This is one of most common parsing PHP errors, I have encountered it mostly due to version conflict.

The PHP version on new server may be different from old one. Most probably lower than old one. Upgrade/ Match PHP version on both servers to get rid of error.

creativeON
  • 31
  • 2
0

You have three single-quote characters between the square brackets: [''']. It looks like PHP is interpreting the first two single-quote characters as a zero-length string, and then getting confused how to interpret the third single-quote.

I expect that the version of PHP, or the error-reporting configuration, differs between the old server and the new. The old server let the error slide, the new one is telling you about it.

Similar to existing questions, Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in PHP and Error Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING

Community
  • 1
  • 1
Jim DeLaHunt
  • 10,960
  • 3
  • 45
  • 74