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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:15:34+00:00 2026-06-01T10:15:34+00:00

I have the following three arrays and need to create a new two-dimensional array

  • 0

I have the following three arrays and need to create a new two-dimensional array where the keys match.

Array
(
    [0] => Item 0
    [1] => Item 1
    [2] => Item 2
    [3] => Item 3
Array
(
    [0] => £35.00
    [1] => £60.00
    [2] => £24.00
    [3] => £79.00
)
Array
(
    [0] => 2
    [1] => 1
    [2] => 1
    [3] => 1
)

I need my new array as follows:

$items = Array( 
           Array("Item 0", "£35.00" , 2),
           Array("Item 1", "£60.00" , 1),
           Array("Item 2", "£24.00" , 1),
           Array("Item 3", "£79.00" , 1)
         );

I’ve tried using array_merge, array_merge_recursive, array_combine, $array1+$array2+$array3 but none of them seem to do what I’m after.

Any pointers would be appreciated 🙂 Many thanks

  • 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-01T10:15:35+00:00Added an answer on June 1, 2026 at 10:15 am

    As long as all the arrays are the same length, you can use array_map­Docs with null as callback

    print_r(array_map(null,
        $array1, $array2, $array3 
    ));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following PHP object but I'm struggling to get the array item
I have two tables: CREATE TABLE items ( root_id integer NOT NULL, id serial
Lets say we have the following two class definitions. #include <iostream> #include <array> class
I have the following three files in the same directory: citysim.cpp #include utils.h using
I have the following three tables. I am trying to inter link (join) among
Let's say I have the following three strings: (section1){stuff could be any character, i
In my project I have the following three interfaces, which are implemented by classes
I have the following code string three() { return three; } void mutate(string& ref)
Let's say I have the three following lists A1 A2 A3 B1 B2 C1
Please consider the following three .NET types: I have an interface, an abstract class,

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.