???
A '-' character is either a subtraction operator, or a negation. You cannot include them in variable names. Did you mean the underscore (_) character instead.
"$thread-trend[...]" is an invalid PHP expression. It means "get the $thread variable, and subtract trend[...] from it. But trend isn't prefixed with a $, so it can't be a variable, it must be a fixed (constant) expression. But constants can't be arrays, therefore, it's invalid syntax"
With the above expression, you should get something like:
Adapt the following to your needs.