You are using PHP7.
Firstly, note that $nodes
in the statement $result = $node->$nodes[$i] = $value
is a variable variable. The problematic part of the statement is $node->$nodes[$i]
itself.
As specified in the PHP7 documention for Backward Incompatible Changes, a number of changes have been made to variable handling, including Changes to the handling of indirect variables, properties, and methods.
This states that: