Home > Backend Development > PHP Tutorial > Description of the formal and actual parameters of functions in presentationfontcache.exe PHP

Description of the formal and actual parameters of functions in presentationfontcache.exe PHP

WBOY
Release: 2016-07-29 08:43:40
Original
977 people have browsed it

PHP will issue a warning when the number of actual parameters the number of formal parameters, PHP will not report an error. It will only take the first few parameters, and the excess will be discarded.
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:

Copy code The code is as follows:


//Write a function swap() and test that the actual parameter value of the function has not changed
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 "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

n";
}
$variablea=5;
$variableb=10;
echo "Before calling the swap1() function: ";
echo "Actual parameter a=$variablea ,actual parameter b=$variableb
n";
swap1($variablea,$variableb);
echo "After calling the swap1() function: ";
echo "Actual parameter a=$variablea,actual parameter b=$ variableb
n";
?>


//The above two examples are just for illustration, please give me some advice~~~

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template