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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:28:39+00:00 2026-05-16T16:28:39+00:00

Date Array array( 0 => array(date_1 => 06-09-2010), 1 => array(date_2 => 07-09-2010), 2

  • 0

Date Array

array(
   0 => array("date_1" => "06-09-2010"),
   1 => array("date_2" => "07-09-2010"),
   2 => array("date_3" => "08-09-2010")
)

Day Array

array(
   0 => array("day_1" => "Monday"),
   1 => array("day_2" => "Tuesday"),
   2 => array("day_3" => "Wednesday")

)

Period Array

array(
   0 =>  array("period_1" => "1"),
   1 =>  array("period_2" => "1"),
   2 =>  array("period_3" => "1")
) 

How can i alter/merge the array so the array will become something like this?

array 0 = date_1,day_1, period_1
array 1 = date_2,day_2, period_2
array 2 = date_3,day_3, period_3

Using array merge will return something like this

array(
   0 => array("date_1" => "06-09-2010"),
   1 => array("date_2" => "07-09-2010"),
   2 => array("date_3" => "08-09-2010"),
   3 => array("period_1" => "1"),
   4 => array("period_2" => "1"), 
   5 => array("period_3" => "1"),  
   6 => array("day_1" => "Monday"),
   7 => array("day_2" => "Tuesday"),
   8 => array("day_3" => "Wednesday")
)

Edited (Answer)

The problem can be solve using this function. Thanks Codaddict!

$date = array(
array('date_1'=>"06-09-2010"),
array('date_2'=>"07-09-2010"));

$day = array(
    array("day_1"=>"Monday"),
    array("day_2"=>"Tuesday")
);

$period = array(
    array("period_1"=>1),
    array("period_2"=>2)
);

$result = array(); 
for($i=0;$i<count($date);$i++) {
    array_push($result,array($data[$i],$day[$i],$period[$i]));
}
var_dump($result);
  • 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-16T16:28:39+00:00Added an answer on May 16, 2026 at 4:28 pm

    You can try:

    $data = array(
        array('date_1'=>"06-09-2010"),
        array('date_2'=>"07-09-2010")
    );
    $day = array(
        array("day_1"=>"Monday"),
        array("day_2"=>"Tuesday")
    );
    $period = array(
        array("period_1"=>1),
        array("period_2"=>2)
    );
    
    $result = array(); 
    
    // assuming all arrays are of same size.
    for($i=0;$i<count($data);$i++) {
        array_push($result,array($data[$i],$day[$i],$period[$i]));
    }
    var_dump($result);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form with a date input. echo $this->Form->create('Nodata'); echo $this->Form->input('date1', array('type' =>
I have a Date array which stored dates and time in its respective positions
I want to sort a mutable array by date. My array contains several dict
I have some code which builds an array of date ranges. I then call
I have an array of Ruby Date objects. How can I find the newest
I want to do array fetch for DATE in oracle with following code. It
I want to echo out each date in my Array within a PHP file.
I am trying to get an array of a date plus the next 13
How do i take a php array $arr = (('date'=>'03-22-2012', 'count'=>1000 ), ('date'=>'03-23-2011', 'count'=>1170
I display my date in CGridView as: 22.6.2012 22:53 with: array('name' => 'date', 'value'

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.