Totally Confused About Public/Private variables in class

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Totally Confused About Public/Private variables in class

Post by jwalsh »

Hey Guys,

I'm totally lost why this doesn't work..

Code: Select all

class Test
{
	private $_variable;

}
... but this does ...

Code: Select all

class Test
{
	var $_variable;

}
Public also does not work. This is not just constrained to variables, but also to functions/methods.

The error is as follows...

Code: Select all

Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /path/to/myfile.php on line 4
Error referencing the Private Definition.

Thanks guys
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post by jwalsh »

What the... where did PHP5 go, and why is 4 back on my server.... that explains everything!

Josh
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

jwalsh wrote:What the... where did PHP5 go, and why is 4 back on my server.... that explains everything!

Josh
Hahahaha :lol:
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

ahem :roll:
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Ask your server's support to turn it back on for your account.

No doubt they switched back to 4 because of complaints from non PHP5 compatable scripts.
Post Reply