RE: [PHP] Problems with Objects & Php4
| From: | Ben Meyer | Date: | Thu, 17 Aug 2000 20:40:10 +0000 |
| Subject: | RE: [PHP] Problems with Objects & Php4 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12352@lists.php.net to get a copy of this message | ||
> Sorry, about this, but let me correct the example.
>
> (1) Are there known problems with Objects in Php4? If so, what are the
> most
> common?
> (2) I am having a problem with two objects. The objects are basically used
> like C/C++ structures without functions, i.e. a collection of variables.
> However, the object is only containing the last value that I put in it.
> Example:
> class Person
> {
> var $Name,$Height,$Weight;
> }
>
> function GetPerson()
> {
> //Query for information, just assume the query returns the below
> results.
> $Me = new Person;
> $Me->$Name = "Al";
> $Me->$Height = "72";
> $Me->$Weight = "130";
> echo $Me->$Name; //Output is 'Al'
> return $Me;
> }
> $Tester = new Person;
> $Tester = GetPerson();
> echo $Tester->$Name; //Output 130, should be 'Al'
>
> Am I doing anything wrong?
>
> Thanks for the help in advance.
>
> Benjamen R. Meyer
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>