0

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...

2
Contributors
2
Replies
4
Views
10 Years
Discussion Span
Last Post by bhakti.thakkar
0

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'.

0

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'.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.