Parameter processing mechanism modification
1. Duplicate parameter naming is no longer supported.
Duplicate parameter naming is no longer supported. For example, when the following code is executed, an error will be reported:
public function foo($a, $b, $unused, $unused) { // ... }Editor's note: No one should use it like this.
2. Adjustment of func_get_arg and func_get_args()
The two methods func_get_arg() and func_get_args() return the current value of the parameter, not the value when passed in. The current value may be modified
function foo($x) { $x++; var_dump(func_get_arg(0)); } foo(1);The above code will print 2 instead of 1. If you want to print the original value, just adjust the order of calls.
3. The modified value is also displayed when printing exception traceback information.
function foo($x) { $x = 42; throw new Exception; } foo("string"); PHP7的运行结果:Stack trace: #0 file.php(4): foo(42) #1 {main} PHP5的运行结果:Stack trace: #0 file.php(4): foo('string') #1 {main}This adjustment will not affect the behavior of the code, but you need to pay attention to this change when debugging.
Other functions related to parameters are subject to the same adjustment, such as debug_backtrace().