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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:05:40+00:00 2026-05-27T13:05:40+00:00

I have the following array: 1 => array 0 => string ‘1’ 1 =>

  • 0

I have the following array:

1 => array
    0 => string '1'
    1 => string '2'
2 => array
    0 => string '7'
    1 => string '8'

And I want to create some objects, in this case 4, size of the first times size of the second.

So I would get:

Object(1,7)
Object(1,8)
Object(1,7)
Object(2,8)

The problem is, I dont know the size of the first array so it could be like this

1 => array
    0 => string '1'
    1 => string '2'
2 => array
    0 => string '7'
    1 => string '8'
3 => array
    0 => string '9'
    1 => string '10'

So I would get:

Object(1,7,9)
Object(1,7,10)
Object(1,8,9)
Object(1,8,10)
Object(2,7,9)
Object(2,7,10)
Object(2,8,9)
Object(2,8,10)

And It could be even bigger.

Sorry for the bad explanation, I cant think of a better way to explain it.

So the question is, how would I go and implement this?
preferably in PHP but Java, C, C++ solutions are accepted since I can relatively easily convert them.

  • 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-27T13:05:41+00:00Added an answer on May 27, 2026 at 1:05 pm

    What you are looking for is the “cartesian product” of your arrays. The first step would be to do something like this: Concatenate values of n arrays in php

    You would then have to convert the arrays to objects, which should not be a challenge.

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

Sidebar

Related Questions

I have the following array: var idParam = [1,2,3]; I want to send this
I have create following string multidimensional array in java. which has top outer array
I have the following array, $myarray[0]['first_name'] $myarray[0]['last_name'] I want to turn it into: $myarray['first_name']
I have the following array: a = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] I use it for some visual
Say we have the following array of instantiated objects: SomeClass[] items = {new SomeClass(Apples,
I have following array string[] words = { cherry, apple, blueberry, banana, mango, orange,
I have the following method in some nemerle code: private static getLinks(text : string)
gcc 4.6.2 c89 I have the following 2D array that I want to pass
I have following array and search string. NSArray *values =[NSArray arrayWithObjects:@abc,@xyz,@cba,@yzx,nil]; NSString *search =
I have the following item in preferences.xml : <ListPreference android:key=pref_movies_min_imdb android:title=@string/pref_movies_min_imdb android:summary=@string/pref_movies_min_imdb_summary android:entries=@array/pref_movies_min_imdb_array_entries android:entryValues=@array/pref_movies_min_imdb_array_values

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.