i have an array of hours[] and minutes[].
hours Array:
Array ( [0] => 11 [1] => 12 [2] => 13 [3] => 14 )


minutes[] Array:
Array ( [0] => 30 [1] => 30 [2] => 30 [3] => 30 )

now i want an array which will merge hours[] and time[] and give me an time[] array someting like below:

time Array:
Array ( [0] => 11:30 [1] => 12:30 [2] => 13:30 [3] => 14:30 )

how can i do it...

there probably is a simpler way but i made this i about 3 mins.

<?php

$hours = array(11,12,13,14);
$mins = array(30,30,30,30);

$count = count($hours);
$i = 0;
while ($i < $count) {
$time[] = $hours[$i] . ":" . $mins[$i];
$i++;
}

?>

all of the times are now stored in an array in the variable '$time'.

Hi,
Thanks 4 ur reply :) . i did it as below:
for($i = 0; $i < count($hours); $i++)
$time[$i] = $hours[$i] . ':' . $minutes[$i];
same way but with a for loop...

there probably is a simpler way but i made this i about 3 mins.

<?php

$hours = array(11,12,13,14);
$mins = array(30,30,30,30);

$count = count($hours);
$i = 0;
while ($i < $count) {
$time[] = $hours[$i] . ":" . $mins[$i];
$i++;
}

?>

all of the times are now stored in an array in the variable '$time'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.