View Full Version : Need help with PHP error message.

03-13-2009, 11:55 AM
Good Day, as you all can see I'm a newbie to Coding Forums and PHP programming. I need some help with a personal project i'm working on.

I downloaded a freelance script. Everything seems to be working fine, but i'm getting an error message when I try to do one or two functions.

This is the error message:

Parse error: syntax error, unexpected T_PRIVATE, expecting ']'

If you guys have an idea of what's wrong or have seen this before or can point me in the right direction, I will appreciate it.

Thanks in advance.


03-13-2009, 12:15 PM
Hey folks,

I've found the solution to the error message.

The issue was a missing "$" before a variable named "private". Apparently "private" is a keyword in php and when using a variable even in [] you still need to include the "$".

So yes problem solved and the code now works. Thanks.


03-13-2009, 12:20 PM
Hold on a minute.
Yep, private is a keyword in PHP5+. However, if the script does not make use of a $ in the first place, I'm inclined to think that it was originally created as a defined constant instead of as a variable. That I can't confirm or deny though.
What you can do, is do a print_r(get_defined_constants(true)); to see if one exists under private.

Wait, it almost sounds like you're meaning an hashmap index. Can you post the code in question (where you're talking about the [] please)