QQ Space background music player code JS and PHP to function pass variable parameters of the difference instance code

Source: Internet
Author: User
# JS Call function method for passing variable parameters

Copy the Code code as follows:




# Methods for passing variable parameters in PHP call function

Copy the Code code as follows:


Method One
Receives a series of parameters and outputs them individually
function Show_params () {
Get the number of pass parameters
$count = Func_num_args ();
Traversing parameters and outputting them individually
for ($i = 0; $i < $count; $i + +) {
Get parameters
$param = Func_get_arg ($i);
Echo $param. Php_eol;
}
}
Calling functions
Show_params (1, 2, ' Apple ', 3.14);
Method 2
function Show_params () {
To define an array of stored pass parameters
$params = Array ();
Get all parameters
$params = Func_get_args ();
$count = count ($params);
Traverse and output parameters individually
for ($i = 0; $i < $count; $i + +) {
echo $params [$i];
Echo Php_eol;
}
}
Note: Method 2 performs slower than Method 1

The above introduces the QQ space background music player code JS and PHP to function transfer variable parameters of the code, including the QQ space background music player code content, I hope that the PHP tutorial interested friends have helped.

  • Related Article

    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.