unexpected T_CONCAT_EQUAL [closed]
-
05-07-2019 - |
Question
I'm getting an unexpected T_CONCAT_EQUAL error on a line of the following form:
$arg1 .= "arg2".$arg3."arg4";
I'm using PHP5. I could simply go an do the following:
$arg1 = $arg1."arg2".$arg3."arg4";
but I'd like to know whats going wrong in the first place. Any ideas?
Thanks, sweeney
Solution
This would happen when $arg1 is undefined (doesn't have a value, was never set.)
OTHER TIPS
So the most accurate reason is that the above posted line of code:
$arg1 .= "arg2".$arg3."arg4";
was actually as follows in my source:
arg1 .= "arg2".$arg3."arg4";
The $ was missing from arg1. I dont know why the interpreter did not catch that first, but whatever. Thanks for the input Jeremy and Bailey - it lead me right to the problem.
sounds like you forgot a semicolon on the line above this one.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow