Home >Backend Development >PHP Tutorial >Description of the formal and actual parameters of functions in presentationfontcache.exe PHP
PHP will issue a warning when the number of actual parameters Copy code The code is as follows: Before entering the swqp() function
When writing a function in PHP, generally when calling a function, the changed values are the formal parameters rather than the actual parameters. But if you add an address character to the formal parameters, the value of the actual parameters will be changed. Why?
Please see Example below:
//Write a function swap() and test that the actual parameter value of the function has not changed
function swap($a,$b ) {
echo "
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
}
$variablea=5;
$variableb=10;
echo "Before calling the swap() function: ";
echo "Actual parameter a=$variablea, actual Parameter b=$variableb
n";
swap($variablea,$variableb);
echo "After calling the swap() function: ";
echo "Actual parameter a=$variablea,Actual parameter b=$variableb< br>n";
?>
Copy the code The code is as follows:
//Test the value change of the swap() function parameter
function swap1(&$a, &$b) {
echo "
Enter 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
The above introduces the description of the formal and actual parameters of the function in presentationfontcache.exe PHP, including the content of presentationfontcache.exe. I hope it will be helpful to friends who are interested in PHP tutorials.