Here is the working code You had __constructor() it's __construct() notice I also moved your saying declaration outside of the constructor. this is to make it a class level variable. the way that you had it set it was only in scope until you finished the construct code. I guess I was wrong about the var bit. I do remember having lots of issues with it back a few months ago. perhaps theses were fixed in newer versions. most likely var is depreciated in php5. (can someone confirm this?) <html> <head> <title>PHP Class testing</title> </head> <body> <br/> <p>This is outside the php code block</p> <br/> <?php echo "Start defining the class here: <br/>" ; class Test { public $saying = ""; function __construct() { $saying = "Im in the Test Class" ; } function get() { return $saying ; } } $liveclass = new Test ; echo $liveclass->get() ; echo "<br/>" ; echo "This is in the php code block" ; ?> </body> </html> On Thursday 20 October 2005 09:53 pm, Bob Hartung wrote: > Changed to: > var $saying ; > public $saying = "....." > > Again, blank page. Funny though, even the <title>...</title> html block > is not rendered. Again, same beavior on 2 FC4 and 1 Win32 install. > > Tnx > > Bob > > Stephen Leaf wrote: > > Sorry.. 1 more thing. > > php5 does not use var. > > use public $variable=value; instead. > > public is only within a class however. you cannot use it outside. > > > > On Thursday 20 October 2005 09:35 pm, Bob Hartung wrote: > >>Hi all, > >> I'm trying to get started in OOP with PHP. I have the following > >>short code snipped. I'f I comment out the 'class Test' definition and > >>the following references to it, it prints > >> This is outside the php code block > >> > >> and > >> > >> Start defining the class here: > >> > >>If I do not comment out the code as noted, then the page returned is > >>totally blank. It does this with or without using the constructor. > >>PHP 5 on apache. Same behavior both on Win32 and FC4. > >> > >>All help appreciated to get me going. > >> > >>Code Snippet: > >> > >><html> > >> > >><head> > >> <title>PHP Class testing</title> > >> > >></head> > >><body> > >> <br> > >> <P>This is outside the php code block</P> > >> <br> > >> <?php > >> echo "Start defining the class here: <BR>" ; > >>/* class Test > >> { > >> > >> function __constructor() > >> { > >> var $saying ; > >> $saying = "Im in the Test Class" ; > >> } > >> > >> function get() > >> { > >> return $saying ; > >> > >> } > >> > >> var $liveclass ; > >> $liveclass = new Test ; > >> echo $liveclass->get() ; > >> echo "<BR>" ; > >> echo "This is in the php code block" ; > >>*/ > >> ?> > >> > >></body> > >></html> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php