return values from class methods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux