Posted by Gerry Vandermaesen on 05/19/06 12:42
Hi,
I was wondering if it's possible to know the name of a variable passed
to a function. It certainly has me puzzling. For example:
<?php
class Template {
var $variables = array();
fuction bind(&$variable) {
$this->variables[...???...] =& $variable;
}
}
$tpl = new Template;
$foo = "bar";
$tpl->bind($foo);
print_r($tpl->variables);
/* Should output:
Array(
'foo' => 'bar'
)
*/
?>
Thanks for your feedback.
Gerry.
Navigation:
[Reply to this message]
|