[development] namespaced global variables [WAS: Drupal 6.2 theme system standalone]
Adrian Rossouw
adrian at bryght.com
Sat Jun 14 15:12:38 UTC 2008
On 14 Jun 2008, at 5:03 PM, Bob Pepin wrote:
> On a side note, the next person designing a callback interface should
> also keep in mind that call_user_func can take array($classname,
> $methodname) as first argument. Would have avoided all the name
> clashes with callbacks in themes right now.
except when you use that format you can't pass references to
functions, as it makes copies of everything
chx wrote a simple call_user_func array replacement that passes
references a few years ago.
basically :
function call($func, &$var1, &$var2, &$var3, &$var4, &$var5, &
$var6 ... etc) {
if (function_exists($func) {
return $func($func, &$var1, &$var2, &$var3, &$var4, &$var5, &
$var6 ... etc);
}
}
More information about the development
mailing list