Presentationfontcache.exe explanation of the problem of the formal participation argument of functions in PHP

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.