re function name must be a string error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello;
In my last post I was struggling with the 
Fatal error: function name must be a string.
when a variable set to an anonymous function
is assigned to a static class member variable.

self::$staticVar = $funct // $funct contains anonymous function def
self::$staticVar(/* args */) // Fatal error: function name must be a string...

The fix I didn't remember, but I have now remembered was:
require(/* file with function def set to $_variable */);
self::$_staticVar = function(/* args */){return $_variable(/* args */)};

But the error may also occur when there is something wrong with the
args. That is what was hanging me up to begin with.

I hope someone can benefit from this experience.
JK






[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux