$ This-& gt; $ function () in PHP? Dear friends, recently, my younger brother is reading the code of daily group buying. The result is in modulesindex. mod. php shows the following code: PHPcodefunctionModuleObject ($ config) {$ this-& gt; MasterObject ($ config); $ this-> $ function () what does it mean in PHP?
Dear friends, recently, my younger brother is reading the code of group buying every day. The result shows this code in/modules/index. mod. php:
PHP code
function ModuleObject( $config ) { $this->MasterObject($config); $runCode = Load::moduleCode($this); $this->$runCode(); }
In the fifth line of code, $ this-> $ runCode (); does this sentence have any special meaning in PHP? I am not trained in PHP, so I don't understand some basic rules that are not commonly used. I hope you will be grateful for your guidance.
------ Solution --------------------
Manual cloud:
Variable functions
PHP supports the concept of variable functions. This means that if a variable name has parentheses, PHP will look for a function with the same name as the value of the variable and will try to execute it.
------ Solution --------------------
$ This-> $ runCode ();
This must be in your class.
------ Solution --------------------
Class ModuleObject extends MasterObject
Go to his parent class and public class to search
Go to the configuration file config. php (usually called this) and check the introduced class file.
------ Solution --------------------
$ RunCode = Load: moduleCode ($ this );
$ This-> $ runCode ();
Does the $ runCode in the second line have a relationship with the $ runCode in the first line?