first, pseudo-type
There are three types of PHP pseudo-types, namely: 1,mixed mixed type. 2,number the numeric type. The 3,callback callback type.
1,mixed Mixed type:
Mixed shows that a parameter can accept many different types, but not all of them.
2,number Number Type:
The number parameter can accept an integer integer and float floating point type.
3,callback Callback Type:
For example, the Call_user_func () function can receive a user-defined function as a parameter, which is a built-in function of PHP. The callback function can be either a function or a method of an object, and the method of a static class can also be used. A PHP function is passed with a function name string that can pass any built-in or user-defined functions, in addition to the language structure such as array (), Echo (), Empty (), eval (), exit (), Isset (), list (), print (), Unset () and so on.
If you want to pass in an object's method, it needs to be passed as an array, the array subscript 0 is the object name, and the subscript 1 is the method name. If there is no static class that is instantiated as an object, to pass its method, replace the object name indicated by the array 0 subscript with the name of the class.
In addition to ordinary user-defined functions, you can use Create_function to create an anonymous callback function.
Example::
<?php//Normal callback function my_callback_function () {echo "My is callback function.";} callback method Class Myclass{static function Mycallbackmethod () {echo "My is callback method.";}} NUM1: Callback function Call_user_func (' my_callback_function ');//num2: Static Class Method Call_user_func (Array (' MyClass ', ' Mycallbackmethod ');//num3: Object Method $obj = new MyClass (); Call_user_func (Array ($obj, ' Mycallbackmethod '));//NUM4: Static Class method (5.3.0 above) call_user_func (' Myclass::mycallbackmethod ');//NUM5: Relative static method call class A {public static function who () { echo "A";}} Class B extends A {public static function who () {echo "B";}} Call_user_func (Array (' B ', ' parent::who '));//output B//NUM6: Incoming parameter function test ($a, $b) {echo $a; echo $b;} Call_user_function (' Test ', ' 1 ', ' 2 ');//Output 1 2//num7: Call class method passed in Parameter Class A () {function B ($c) {echo $c;}} Call_user_func (Array (' A ', ' B '), ' 1 ');//The output 1//num8:call_user_func_array is similar to Call_user_func, except that the parameter is passed in a different way, Make the parameter structure clearer: function A ($b, $c) {echo $b; echo $c;} Call_user_func_array (' A ', Array (' 1 ', ' 2 '));//Output 1 2//NUM9: Call the class internal method with Call_user_func_array classes a () {function A ($b, $c) {ECHo $b; echo $c;}} Call_user_func_array (Array (' A ', ' a '), Array (' 1 ', ' 2 '));//Output 1 2//num10:call_user_func functions and Call_user_func_array functions support references , which makes them more functionally consistent with normal function calls: function A ($b) {$b + +;} $c =0;call_user_func (' A ', $c);//Output 1call_user_func (' A ', Array ($c));//Output 2
Second, pseudo-variable
$ in PHP ... The meaning of a pseudo-variable, indicating, and so on, when a function can accept any parameter, use this variable name.