It's not possible, imagine

$firstname = new flashPash();
$secondname = $firstname;

Now is the log name secondname.log or firstname.log. Use new property.

Simon McKenna wrote:

>Hi all,
>
>I'm new to the php world and have just finished building my first class,
>
>It works pretty well, but i've run into a quandary adding debug code,
>my problem is thus:
>
>Many objects get created by this class, often in the same php script,
>and the debug log is an actual file.  At the moment i'm naming the file
>after the name of the class, but what I would really like to do is name
>the log file after the name of the object instantiated from the class. e.g.
>
>class flashPash {
>....
>   $this->fpLog = fopen("flashPash.log","w+");
>....
> function debugLog($LogMsg) {
>  if (($this->debug == true) && (!empty($this->fpLog)))
>   fwrite($this->fpLog,$LogMsg."\n");
> }
>}
>
>$fpObject = new flashPash();
>$fpObject->debug = true;
>....
>
>
>so...is there a way I can get the variable name "fpObject" from within
>flashPash itself?  i.e. so I can make the logfile "fpObject.log" instead
>of "flashPash.log"
>
> I realise it would be trivial to create a new property of the class to
>store the debug log filename, but i'm hoping I can avoid this?
>
>"get_object_vars" & "get_class" appear to be heading in the right
>direction...but not quite...so...any ideas?  is this actually possible?
>I kinda want to go down the hierarchical tree, instead of going up it :)
>
>thanks for any help.   php rocks!
>si
>
>
>
>
>  
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to