I made this stupidly simple PHP file containing
<?php
class stuff {
private $var;
}
?>
and results in this error when run:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in . . . on line 4
To make things even more confusing, it functions normally on a different domain with the same host. Surely the folder and domain have nothing to do with whether class properties can be defined. What is going on here??
That’s legal PHP code. I’d guess you’re testing it in a machine that has PHP 4 installed. Support for PHP 4 has been discontinued for a long time; it’s strongly recommended to upgrade.