NYCPHP Meetup

NYPHP.org

[nycphp-talk] getting an object's variable name

Jeff Knight jeff.knight at gmail.com
Tue Mar 14 12:30:33 EST 2006


Greetings from TX you chilly state-tax-paying nerds! I hear the
group's alcohol consumption has diminished dramatically since I left.
I bet T.G.I.F misses me the most.

I actually have a question for y'all (all'y'all? y'all all?). Is it
possible to get the variable name used by an object from that object?
If I had

class Example {	
	function varName() {
		// what goes here?
	}
}

$nyphp = new Example() ; $txphp = new Example();

I want $nyphp->varName() to return the string 'nyphp', and
$txphp->varName() to return 'txphp'



More information about the talk mailing list