Interface Dispatch2{public function Getcontroller ();} Class QueryString implements Dispatch2{public function Getcontroller ($url = ', $url 2 = ') {echo ' 234 ';}} $b = new QueryString (); Echo $b->getcontroller ();
The above procedures can be normal operation, it is understood that Java inside like this usage is not possible, and this usage seems to be quite unreasonable, why in PHP can be used?
Reply content:
Interface Dispatch2{public function Getcontroller ();} Class QueryString implements Dispatch2{public function Getcontroller ($url = ', $url 2 = ') {echo ' 234 ';}} $b = new QueryString (); Echo $b->getcontroller ();
The above procedures can be normal operation, it is understood that Java inside like this usage is not possible, and this usage seems to be quite unreasonable, why in PHP can be used?
The function Call of PHP is to find the function that corresponds to the function name by checking the table.
PHP's function overloading differs from other languages in that it receives a different number of arguments, actually passing it as an array to the function.
So the function call you enumerate, without parameters, can be executed because the argument array is empty, which is reasonable.
PHP function calls do not check for matching of the number of parameters.
Reference: Here
And here it is.