steveangelis Posted November 16, 2010 Share Posted November 16, 2010 I am working on a site that was made a while ago and on a custom page I am making I am needing to call up variables and my brain is too fried to think up the solution for this. The standing code is this: class site{ var $name = 'Site'; var $data = 'on'; { What I need to do is callup the variables, such as $name, as simple as possible. How would I do this? Quote Link to comment https://forums.phpfreaks.com/topic/218813-calling-up-class-variable/ Share on other sites More sharing options...
trq Posted November 16, 2010 Share Posted November 16, 2010 Providing the properties are public (which they are considering your using the old php4 syntax). class site { var $name = 'Site'; var $data = 'on'; } $s = new site; echo $s->name; echo $s->data; Quote Link to comment https://forums.phpfreaks.com/topic/218813-calling-up-class-variable/#findComment-1134845 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.