Recently in the study of the object-oriented programming of PHP, the idea of object-oriented thinking in solving complex problems really play a huge role, can not imagine if the StarCraft game is not used in the development of object-oriented thinking is how complex. The object-oriented idea is indeed a significant advance in the history of computer programming methods.
Today in the class method that you create to call another class method as its callback function, I would like to write directly in the callback function where the name of another class method directly, but has been an error saying "Invalid Parameters", and then a thought is not to use the Self keyword to try, the result is reported this error. I do not know what to do, check the Chinese manual has not found a solution, and then carefully read the PHP official website manual, this manual has to solve the problem of the grammar.
Class utils{public function Array_or ($input) { return array_reduce ($input, Array (' utils ', ' Sum '), 0);
} public function sum ($v, $w) { return $v + = $w; }} $uti = new Utils; $a = array (1,2,3,4,5); Echo $uti->array_or ($a);
It makes me wonder why calling another class method would be in the form of an array, as if it were more appropriate to use the Self keyword, and I really don't know what they are thinking about designing such a grammar. However, I think that since the design of others must have his reason, but I have not realized this truth.