I have an array like this in php
Array
(
[0] => Array
(
[month] => April-2014
[total_booking] => 2
)
[1] => Array
(
[month] => May-2014
[total_booking] => 5
)
[2] => Array
(
[month] => June-2014
[total_booking] => 25
)
[3] => Array
(
[month] => October-2013
[total_booking] => 1
)
[4] => Array
(
[month] => July-2014
[total_booking] => 4
)
)
I have to make this array
if i selected two months from_month , to_month if there are no any months in this array it should be included eg:
i have selected from_month 2014 feb to_month 2014 may . but if in my array only 2014 feb, 2014 april,2014 may only so iwat to include 2014 march in correct place. like this
Array
(
[month] => March-2014
[total_booking] => 0
)
this is my code
foreach ($newarray as $month => total_booking) {
//sorting
}
foreach ($newarray as $month => total_booking) {
//if there is no month in array betwean to_month and from_month it
should be included in correct place as sorted
}