I've been using a function to output HTML to the user's browser, and now my
use has made it neccessary to put it all inside a class.

All's going find and dandy and I've got it all working. However one of it's
variables is $front_page.

Now in other pages there are references to $front_page, and I want to change
them to something like $objectname->front_pagee.

The problem is that I can't know what the object will be named ahead of
time!

So my hack-around is in the class constructor I set a global variable called
$pge with the value submitted to the constructor. So someone would do this:

$somename = new Display(somename);

But if someone typos the and the name of the variable is different from the
one submitted to the constructor, all the code will break! That's because
I'm using a variable variable to refer to $front_page, like this:

${$pge}->front_page

I told you it was a hack-around, and it isn't a good one.


So is there ANY way to get the name of the object in PHP code without
knowing the name of the object ahead of time?

I'm really stumped!



--
Plutarck
Should be working on something...
...but forgot what it was.





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to