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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:49:01+00:00 2026-06-07T17:49:01+00:00

I want to combine three php arrays by taking one entry and placing it

  • 0

I want to combine three php arrays by taking one entry and placing it underneath the other, like so:

while ($i <= $no)
{
        $results[$i] = $blah[$i];
        $i++;
        $results[$i] = $thing[$i];
        $i++;
        $results[$i] = $something[$i];
        $i++;
}

However the problem with this is $no can be exceeded as I need to increment $i three times in each loop.

End result:

array (size=12)
  1 => 
    array (size=4) (from $blah)
  2 => 
    array (size=4) (from $thing)
  3 => 
    array (size=4) (from $something)
  4 => 
    array (size=4) (from $blah)

…this needs to continue until the size of $no is met

  • 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-07T17:49:04+00:00Added an answer on June 7, 2026 at 5:49 pm

    simple tought, can’t you do something like this???

       while ($i <= $no)
            {
                    $results[$i] = $blah[$i];
                    $i++;
                    if($i > $no){ break;}
                    $results[$i] = $thing[$i];
                    $i++;
                    if($i > $no){ break;}
                    $results[$i] = $something[$i];
                    $i++;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three tables which I want to combine into one view or temporary
I have three arrays of strings and i want to combine them and write
I want to combine strings in PHP. My script creates every possible combination like
I want to combine three tables - date, lead and click - in a
I want to combine three sprites and display it as a single sprite. I
I want to combine these two queries into one: mysql_query(INSERT INTO categories (name, parent)
i have three arrays in php script $arr1=(a,b,c) //(1,2,3) $arr2=(d,e,f) //(4,5,6) $arr3=(g,h,i) //(7,8,9) note
I have two arrays of values that I would like to combine - but
Possible Duplicate: Transposing multidimensional arrays in PHP I have three arrays: $a = (a1,
This is the sequel to this question . I would like to combine three

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.