Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8451373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:13:18+00:00 2026-06-10T11:13:18+00:00

You know how PHP’s isset() can accept multiple (no limit either) arguments? Like I

  • 0

You know how PHP’s isset() can accept multiple (no limit either) arguments?

Like I can do:

isset($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11);
//etc etc

How would I be able to do that in my own function? How would I be able to work with infinity arguments passed?

How do they do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:13:20+00:00Added an answer on June 10, 2026 at 11:13 am

    func_get_args will do what you want:

    function infinite_parameters() {
        foreach (func_get_args() as $param) {
            echo "Param is $param" . PHP_EOL;
        }
    }
    

    You can also use func_get_arg to get a specific parameter (it’s zero-indexed):

    function infinite_parameters() {
        echo func_get_arg(2);
    }
    

    But be careful to check that you have that parameter:

    function infinite_parameters() {
        if (func_num_args() < 3) {
            throw new BadFunctionCallException("Not enough parameters!");
        }
    }
    

    You can even mix together func_*_arg and regular parameters:

    function foo($param1, $param2) {
        echo $param1; // Works as normal
        echo func_get_arg(0); // Gets $param1
        if (func_num_args() >= 3) {
            echo func_get_arg(2);
        }
    }
    

    But before using it, think about whether you really want to have indefinite parameters. Would an array not suffice?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know PHP 5 already supports SQLite but for some reason I can't get
i only know php and i wonder if you can extend a php web
Possible Duplicate: Get Client IP using just Javascript? I know PhP can know your
I am pretty new to codeigniter. I do know php. How can I accomplish
I know PHP scripts can run concurrently, but I notice that when I run
I know you can control the size of uploads in PHP using $_FILES['userfile']['size'] >
I know (PHP's) var_dump is supposed to be human readable and all, but analyzing
Pretty basic programming question, I know PHP have a function for it, but does
not sure why my code wont work, im teaching myself javascript i know php
I know that PHP is compiled to byte code before it is run on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.