When the number of arguments <形参个数 时php会发出警告,因为php的解释机制会认为,有参数被定义了却没有被使用,那很可能会影响函数的功能。所以会发出警告。然而,当 实参个数> When the number of formal parameters, PHP will not error, it will only take the previous several parameters, the excess will be discarded.
When you write a function in PHP, the function is normally called, and the value changed is a formal parameter instead of an argument. But if you add the address character to the parameter, you change the value of the argument, why?
Take a look at the following example:
Copy the Code code as follows:
Write a function swap () to test that the function's argument value does not change
function swap ($a, $b) {
echo "
Before entering the SWQP () function
\ n ";
echo "before Exchange: formal parameter a= $a, formal parameter b= $b
\ n ";
$c = $b;
$a = $b;
$b = $c;
echo "After Exchange: formal parameter a= $a, formal parameter b= $b
\ n ";
echo "Exit Swap () function
\ n ";
}
$variablea = 5;
$variableb = 10;
echo "Call Swap () function before:";
echo "argument a= $variablea, argument b= $variableb
\ n ";
Swap ($variablea, $variableb);
echo "After calling the Swap () function:";
echo "argument a= $variablea, argument b= $variableb
\ n ";
?>
Copy the Code code as follows:
Change the value of the test swap () function argument
Function Swap1 (& $a,& $b) {
echo "
Enter the SWAP1 () function
\ n ";
echo "before Exchange: formal parameter a= $a, formal parameter b= $b
\ n ";
$c = $b;
$a = $b;
$b = $c;
echo "After Exchange: formal parameter a= $a, formal parameter b= $b
\ n ";
echo "Exit Swap () function
\ n ";
}
$variablea = 5;
$variableb = 10;
echo "Call the Swap1 () function before:";
echo "argument a= $variablea, argument b= $variableb
\ n ";
Swap1 ($variablea, $variableb);
echo "calls the Swap1 () function after:";
echo "argument a= $variablea, argument b= $variableb
\ n ";
?>
The above two examples are instructions, ask for advice ~ ~ ~
The above describes the Presentationfontcache.exe php function of the formal participation of the problem description, including the presentationfontcache.exe aspect of the content, I hope that the PHP tutorial interested in a friend helpful.