Unusual designations of passage on the link?

In an obsolete php script, I found the following line of code:

$CacheLite =& ( "string" );

This causes an error:

Parse error: syntax error, unexpected '(', expecting T_NEW or T_STRING or T_VARIABLE or '$'

This is a mistake or a method of passing by reference or something else that I do not know. Do I have to enable / disable something in my php configuration in order for this to work?

+3
source share
3 answers

You cannot reference a literal value or expression in PHP; it must be a reference to a variable. I have no idea how this line of code appeared (why $CacheLiteis it assigned to any random line?) - probably an error in outdated code.

+4
source

, / . ( , ..) (, ("string")) .

:

$a = "string";
$b = &$a;
+3

This must be a mistake. There is no syntax. Linking to a literal or expression is just fake.

+1
source

Source: https://habr.com/ru/post/1775100/


All Articles