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

The Archive Base Latest Questions

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

I have something like this function f1($name = ”){ f2(prefix_{$name}, $args); } the f1()

  • 0

I have something like this

  function f1($name = ''){
    f2("prefix_{$name}", $args);
  }

the f1() function is called like:

f1('name', $var1, $var2, $var3);

How can I pass these variables to f2() inside it, the same way they are passed to f1() ?

so instead of f2("prefix_{$name}", $args);

it should be like f2("prefix_{$name}", $var1, $var2, $var3);

Not that I have no control over the f2 function 🙁

  • 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-24T22:02:59+00:00Added an answer on May 24, 2026 at 10:02 pm
    function f1( $name = '' )
    {
        // get all arguments to this function
        $args = func_get_args();
        // prefix the first arguments with some prefix
        $args[ 0 ] = 'prefix_' . $name;
        // call the second function with the $args array as its arguments
        call_user_func_array( 'f2', $args );
    }
    

    edit:
    replaced

    $args[ 0 ] = 'prefix_' . $args[ 0 ];
    

    with

    $args[ 0 ] = 'prefix_' . $name;
    

    to account for what Gerry said in his answer.

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

Sidebar

Related Questions

I have something like this: dog = function () { this.age; this.name; this.dog1 =
So I have something like this: var xmlStatement:String = xmlObject.node[3].@thisValue; What mystery function do
So I have a function that looks something like this: float function(){ float x
I have a function that looks something like this: //iteration over scales foreach ($surveyScales
I have a script that looks like this #!/bin/bash function something() { echo hello
This is a C# console application. I have a function that does something like
I have something like this: function cat_filter() { $.ajax({ type: POST, url: 'json/cat_filter.aspx', data:
Let's say I have something like this: abstract class Parent { protected function foobar($data)
I have a function which implement an interface. something like this: string IMyInterface.MyFunction() {
i have something like this: $(#btn).click(function (event) { $.getJSON(url, function (data) { // i

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.