Lamez Posted October 18, 2008 Share Posted October 18, 2008 I have something like this <?php class Session { //other junk } ?> can I put a regular string under class Session? Like so: <?php class Session { $salt = "poopscooper1"; //other junk } ?> If not, where should I put it so it can be defined all through out the class? Quote Link to comment https://forums.phpfreaks.com/topic/128923-solved-last-question-about-classes/ Share on other sites More sharing options...
Prismatic Posted October 18, 2008 Share Posted October 18, 2008 <?php class myClass { public $var = "Hello World"; public function ePrint() { echo $this->var; } } $class = new myClass(); echo $class->var; echo "<br />"; $class->ePrint(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/128923-solved-last-question-about-classes/#findComment-668421 Share on other sites More sharing options...
Lamez Posted October 18, 2008 Author Share Posted October 18, 2008 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/128923-solved-last-question-about-classes/#findComment-668494 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.