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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:18:08+00:00 2026-05-28T11:18:08+00:00

Question may be confusing… the php array_merge() function takes an unlimited amount of arguments

  • 0

Question may be confusing…

the php array_merge() function takes an unlimited amount of arguments E.G.

array_merge($array1, $array2, $array3, $array4, $array5, $array6, $array7);

but what if I want to call this from within a function?

I have a merge() function that can be overloaded, and I want to do things to the array before concatenating them!

so how is array_merge called when I’ve got the array arguments in an array?

EXAMPLE

public function index() {

    $head = $this->_model->title("Index Page"); // returns array

    $nav = $this->_model->navigation(); // returns array

    $default = $this->_model->default_page(); // returns array

    $data = $this->merge($head, $nav, $default); // merge all arrays

    $this->loadView( 'view_admin', $data );
}

private function merge(){
    $args = func_get_args();

    // ... do stuff the the arrays ...

    return array_merge($args[0],$args[1],$args[2]);
}

As you can see, currently in my merge function is:

return array_merge($args[0],$args[1],$args[2]);

This is hardcoded in.

How do I dynamically call the array_merge() function???

maybe something like

array_merge(/* All Array args passed in */) 
  • 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-28T11:18:09+00:00Added an answer on May 28, 2026 at 11:18 am
    return call_user_func_array('array_merge', $args);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an SQL question which may be basic to some but is confusing
This may be a very basic question. But I am finding it confusing with
The formulation of the question may be confusing. I do understand why it is
My question may be a little confusing, but anyway. My school is going to
Ok so my question title may have been a little confusing. Here's my example:
This question may be too product specifc but I'd like to know if anyone
This question may sound fairly elementary, but this is a debate I had with
My question may not make sense but I have valid reason. We use .net
This question may seem trivial, but I hope you won't ignore it. Before destroying
The question may be a little vague but here's an example of what 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.