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 946815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:58:55+00:00 2026-05-15T22:58:55+00:00

In short, what I want is a kind of export() function (but not export()),

  • 0

In short, what I want is a kind of export() function (but not export()), it creates new variables in symbol table and returns the number of created vars.

I’m trying to figure out if it is possible to declare a function

function foo($bar, $baz)
{
    var_dump(func_get_args());
}

And after that pass an array so that each value of array would represent param.

Just wondering if it is possible (seems that is not).

I need this for dynamic loading, so number of arguments, size of array may vary – please dont offer to pass it as

foo($arr['bar']);

and so on.

Again, ideal thing solution will look like

foo(array('foo'=>'1', 'bar'=>'2', ..., 'zzz'=>64));

for declaration

function foo($foo, $bar, ..., $zzz) {}

As far as I rememeber in some dynamical languages lists may behave like that (or maybe I’m wrong).

(I want to create dynamically parametrized methods in class and built-in mechanism of controlling functions arguments number, default value and so on is quite good for this, so I could get rid of array params and func_get_args and func_get_num calls in the method body).

Thanks in advance.

  • 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-05-15T22:58:55+00:00Added an answer on May 15, 2026 at 10:58 pm

    You’re looking for call_user_func_array

    example:

    function foo($bar, $baz)
    {
        return call_user_func_array('beepboop',func_get_args());
    }
    
    function beepboop($bar, $baz){
        print($bar.' '.$baz);
    }
    
    foo('this','works');
    //outputs: this works
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to consult SQL Server OR short-circuit Code: DECLARE @tempTable table ( id
I want to make a short URL service for 2 million assets but I
I'll make this as short and to the point as possible, but it's kind
I'm kind of lost. I made a sort of 'master page' that I want
In short: I want to have two fullscreen views, where I can switch between
SHORT DESCRIPTION OF PROBLEM: I want to set the text of a searchbar without
I want to store short arrays in a field. (I realize there are reasons
I want to develop a short url system, like bitly, and I have a
I want to make a long list short by hiding some elements in long
I want to test whether a certain string is contained in a short list

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.