Differences between func_get_args (), func_get_arg (), and func_num_args () in PHP

Source: Internet
Author: User
Let's take a look at the differences between the three functions of PHP [unc_get_arg (), func_get_args (), func_num_args ()]. let's take a look at the following instance code. The code is as follows:


Function jb51 (){
Print_r (func_get_args ());
Echo"
";
Echo func_get_arg (1 );
Echo"
";
Echo func_num_args ();
}

Jb51 ("www", "jb51", "net ");
?>

Output result:

Array ([0] => blog [1] => micxp [2] => com)
Micxp
3

From the above results, we can see that

Func_get_args () This function returns an array containing all the parameters of the current function.
The func_get_arg () function returns the value of the parameter at the specified position.
Func_num_args () This function returns the number of parameters returned by the current function

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.