You are here: Knowing a variables name? « All PHP « IT news, forums, messages
Knowing a variables name?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация