Like this:
function foo (& $argument = ' bar ') {...}
This makes it possible to invoke:
Foo ();
Foo ($xxx);
Reply content:
Like this:
function foo (& $argument = ' bar ') {...}
This makes it possible to invoke:
Foo ();
Foo ($xxx);
It can be ... But what good is this? Very strange usage.
This is like a method overload in Java, which is a method that handles the number of invariant parameters and assigns default values to the parameters. The Java overload needs to define multiple functions, simplifying it to just one function.
But for multiple functions, it is important to note that if a function assigns a default value, then all functions in the function table that are behind him must have a default value, otherwise the default value in the parameter table is meaningless, that is, when called, you can only choose not to pass a parameter and all parameters after it.