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? 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(); ?> 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! 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
Archived
This topic is now archived and is closed to further replies.