What is the use of a function that can have more arguments than formal parameters?

Source: Internet
Author: User
Tags mul
function test ($date, $value) {    echo "$date $value";} $date = "September 18"; $value = "n"; $y = "2"; Test ($date, $value, false);

What is the use of a function that can have more arguments than formal parameters?


Reply to discussion (solution)

For your design, more useless!

For your design, more useless!


In the official website does not have such case, this has the design case?

Doesn't seem to have any eggs.

Doesn't seem to have any eggs.



It's not clear what he meant by this design.

Design for an argument more than a parameter

function Mul ($a) {  $b = Func_num_args () > 1? Func_get_arg (1): $a;  return $a * $b; }echo Mul (2); 4echo Mul (2, 3); 6
  • 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.