Reputation:
I am getting the following error:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}'
The referenced lines are:
class Food {
private $q = array();
private $nutrients = array();
...
How can I fix this error?
Upvotes: 0
Views: 161
Reputation: 905
you can only use "private" in a php 5 environment. It looks like you're running that in PHP 4.
Upvotes: 6
Reputation: 3332
This is likely to be caused by a string that is declared further on in your class somewhere outside any function calls or variable declarations.
Another likely cause is a missing semicolon on the end of one of your declarations.
Can you please provide more code (including the offending line number).
Upvotes: 0
Reputation: 3414
I think you're missing an ending curly brace '}'. (at least you did in the provided code).
But it's hard to tell with as less code as you provided. Please provide more code on the issue.
Upvotes: 0