Resolve “Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting …” error

Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /directory/wp-content/themes/123/header.php on line 150
If you are encountering the above error in PHP script, it could be related to the compatibility issue between your version of PHP and the code in your script. Try the following solution.