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

  • Home
  • SEARCH
  • 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 8824137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:31:56+00:00 2026-06-14T06:31:56+00:00

I have 3 arrays, just 7 elements in them each. Arrays are: filename[] title[]

  • 0

I have 3 arrays, just 7 elements in them each. Arrays are:

filename[]

title[]

description[]

I want to express and iterate through a single associative array for each of the data in the arrays above. filename can be the key value for the assoc array, but each filename has it’s own corresponding title and description.

Below is a sample of:

var_dump($filename)
    string(10) "IMG_1676_3" [1]=> 
    string(10) "IMG_0539_3" [2]=> 
    string(8) "IMG_1942" [3]=> 
    string(8) "IMG_1782" [4]=> 
    string(8) "IMG_2114" [5]=> 
    string(8) "IMG_9759" [6]=> 
    string(8) "IMG_2210" }

var_dump($title)
    string(31) "Lighthouse at Ericeira Portugal" [1]=> 
    string(23) "Gaudi park in Barcelona" [2]=> 
    string(32) "Driving around outside of Lisbon" [3]=> 
    string(16) "Madeira Portugal" [4]=> 
    string(15) "Barcelona Spain" [5]=> 
    string(15) "Lisbon Portugal" [6]=> 
    string(14) "Sailing Lisbon" }
  • 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-14T06:31:58+00:00Added an answer on June 14, 2026 at 6:31 am
    function mergeArrays($filenames, $titles, $descriptions) {
        $result = array();
    
        foreach ( $filenames as $key=>$name ) {
            $result[] = array( 'filename' => $name, 'title' => $titles[$key], 'descriptions' => $descriptions[ $key ] );
        }
    
        return $result;
    }
    

    Just make sure you pass valid input to the function, or add some extra checking. Is that what you’re looking for?

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

Sidebar

Related Questions

I have two arrays of different length. I want to put them into hash,
I just started using php arrays (and php in general) I have a code
I have an array of objects and I want to add another object just
Objective: I have a list of header files (about 50 of them), And each
I have two arrays ( i made them from jQuery from a table), the
I just have the array of 15 values that all need to be inserted
I have an array of slides $slide = $(.slide) Just one of those slides
I have an array Y of the form(it is just an example, i have
I have an array which has many values in it . I just wanted
I have an array of strings(as shown in example). I just wish to find

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.