re function name must be a string error

From: Date: Mon, 10 Dec 2018 05:28:20 +0000
Subject: re function name must be a string error
Groups: php.general 
Request: Send a blank email to php-general+get-326634@lists.php.net to get a copy of this message
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

« previous php.general (#326634) next »