php3-list | 199903
Date: 03/30/99
- Next message: Steve Douville: "RE: [PHP3] Accessing variables created in a class"
- Previous message: Adam Gotheridge: "[PHP3] sybase / php3 on win32"
- In reply to: Steve Douville: "[PHP3] Accessing variables created in a class"
- Next in thread: Steve Douville: "RE: [PHP3] Accessing variables created in a class"
- Reply: Steve Douville: "RE: [PHP3] Accessing variables created in a class"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> <?
> 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?
Your syntax is off. Use:
class myClass {
var $myVar = "anyString";
}
print $newObj->myVar;
-Rasmus
-- 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>
- Next message: Steve Douville: "RE: [PHP3] Accessing variables created in a class"
- Previous message: Adam Gotheridge: "[PHP3] sybase / php3 on win32"
- In reply to: Steve Douville: "[PHP3] Accessing variables created in a class"
- Next in thread: Steve Douville: "RE: [PHP3] Accessing variables created in a class"
- Reply: Steve Douville: "RE: [PHP3] Accessing variables created in a class"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

