Try $myvar->squareit(11); echo "Result is " . $myvar->myb; In the code you supplied, $tclass is never defined, but because you using it like an object (with the OO call '->'), PHP guesses its type, which is why you get the result OBJECT. However, if you called echo $myvar, you'd get the same result, as you are only referencing the object itself, not a property of it. To get any sensible answers, access the class variables. Hope that helps, Brian --- In php-objects@yahoogroups.com, John Garvin <jgarvin@g...> wrote: > > Hi, > I'm getting confused here. Perhaps someone could point me to an > appropriate section of the manual? > > I have a class defined like so: > <?php > class tclass { > var $mya; > var $myb; > > function tclass() { > $this->mya = ""; > $this->myb = ""; > } > function & squareit($mya) { > $this->myb = ($this->mya * $this->mya); > return $this->myb; > } > } > ?> > > and I'm calling it like this: > <?php > require('tclass.php'); > > $myvar = new tclass; > $tclass->squareit(11); > > echo "result is $tclass"; > ?> > > it outputs "result is Object". > When I include the function 'squareit' in a script without the oo > stuff, I get the result I expect. > What am I missing? > > Thanks very much. > > -- > jpg ------------------------ Yahoo! Groups Sponsor --------------------~--> $9.95 domain names from Yahoo!. Register anything. http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> PHP Data object relational mapping generator - http://www.meta-language.net/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/