RE: [PHP3] Object Oriented PHP From: John Coggeshall (someone <email protected>)
Date: 08/31/99

Here is an example that should work fine for variable objects:

$test = $list."->Name = nm;";

eval($test);

Kind of backwards, but should work.

John

> -----Original Message-----
> From: Sam Turner [mailto:squirrley5 <email protected>]
> Sent: Tuesday, August 31, 1999 10:11 PM
> To: php3 <email protected>
> Subject: [PHP3] Object Oriented PHP
>
>
> I am working on my first PHP project right now, and am having trouble
> getting it to work the way I want it to. I am relatively new to OOP as a
> whole, but I understand the basic concepts.
>
> The main problem / question is that I know that you can use variable
> variables, but can you use variable objects? I have something like this (a
> lot more complicated, of course) :
>
> class foo{
> var $Name;
> };
>
> and then in another spot in the code, I have a certain
> variable... for this
> example, I will use $list:
>
> $list = "Whatever";
> $nm = "testing_foo";
>
> then the trouble spot:
>
> ${$list} = new foo;
> ${$list}->Name = $nm;
>
> I get a parse error on the second line of that... I would expect
> that if it
> is not possible to declare a variable object like
> ${$list} = new foo;
> that the error would come on that line. Any clues?
>
> Btw, I am pretty sleepy right now, so I'm not sure that makes
> much sense...
> if if doesn't, just email me and I'll try to explain it better in the
> morning... =)
>
> Thanks in Advance.
>
> Sam Turner
> aka Squirrley5
>
>
>
> --
> PHP 3 Mailing List <http://www.php.net/>
> To unsubscribe, send an empty message to php3-unsubscribe <email protected>
> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
> To search the mailing list archive, go to:
> http://www.php.net/mailsearch.php3
> To contact the list
> administrators, e-mail: php-list-admin <email protected>
>

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>