Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199903

[PHP3] Accessing variables created in a class From: Steve Douville (douville <email protected>)
Date: 03/30/99

I have a variable that is defined within a class that I want to send to the
screen.

<?
class myClass{

        $myVar = "anyString";
}

$newObj = new myClass;

print $newObj->myVar; (from manual, cart example; also tried with echo)

?>

This doesn't send the value of $myVar to the screen. However, if I have an
echo in the class itself it prints the variable but for real world use I
would want to be able to print the variable at any time.

What am I missing. The example in the manual is a little different in that
the variable was set from outside of the class, so to speak. What is the
solution?

Thanks in advance.

Steve

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3
List administrator:  zeev-list-admin <email protected>