In article <069f01c084ca$1642a320$[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
("Richard Lynch") wrote:

> > I'm trying to pass a string variable to a custom function, echoing its
> > *value on one line, and its *name (that is, its key if this were an array
> 
> I think you are looking for "variable variables"...

A variable variable results in a second variable which is named for the 
*value of the first.  So what I need is a sort of "inverse variable 
variable" to extract the *name of the first variable:

$foo="bar"
echo $foo   //"bar"
echo [something] //"foo"

I ended up doing a clumsy workaround by altering $foo--

$foo="bar"
$foo=array("foo"=>$foo)
echo $foo[key($foo)];  //"bar"
echo key($foo); //"foo"

--but then I'm having to tell PHP the very info that I was hoping it'd 
dynamically tell me. Any other suggestions would be much appreciated!

-- 
CC

-- 
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