merrging two arrays at specific date if both date matched
<p>I am merging the two arrays at particular date. If both array have same date then it will merge the array &amp; plot that array on the graph. But problem is that it is merging the array &amp; appending the bar at the start of the bar only, but not at the specific date where the both date are equal.
for e.g. </p>

<pre><code>array1 = (18/03/2013 =&gt; 10, 20-03-2013 =&gt; 6, 21-03-2013 =&gt; 10);
array2 = (20-03-2013 =&gt; 5);
</code></pre>

<p>. so it should append the bar at <code>20-03-2013</code> but actually it is appending the bar at the start only i.e. <code>18-03-2013</code>. </p>

<p>plz help me thanks in advance</p>

<p>hear is my code</p>

<pre><code>   // gives the how many calls has came per day
$count = __Select("tbl_call_master","COUNT(DATE(date_time)) AS call_count ,  DATE(date_time)AS date ","WHERE DATE(date_time) BETWEEN      '$from_date' AND '$to_date' GROUP BY DATE(date_time) ");

$get_first_array=array(); //created the array to store the result


while($row = mysql_fetch_array($count))
{
    // daily records are been saved in record1[] array  
    $record1[]= array(
        $row['date'],
        $row['call_count']
    );

}
// gives the how many calls has came per day where status is WIP(work in progress) 
$wip=  __Select("tbl_call_master","COUNT(DATE(date_time)) AS  call_count , DATE(date_time) AS date ","WHERE status= 'WIP' AND DATE(date_time) BETWEEN '$from_date' AND '$to_date' GROUP BY DATE(date_time) ");

while($row= mysql_fetch_array($wip))
{
    //daily records are been saved in wiprecord[] array 
    $wiprecord[]= array(
        $row['date'],
        $row['call_count']
    );

}
$chk=0;
// foreach runs till the records are there  
foreach ( $record1 as  $key=&gt; $value ) { 

// it will $chk is 1 if
     if($chk==1){ 
         $get_first_array[$key] =  $record1[$key]; //this record1 is gets transfer in another array which  i am going to show in graph
     }
//foreach runs till the wiprecords are there    
foreach ( $wiprecord as  $key=&gt; $value1) {


end($wiprecord);// it will give the last index of wiprecord

    $last=key($wiprecord); // last index is stored in last variable
    if($key==$last ){ // if key is last then it will make the $chk to 1
        $chk=1;
    }
    if($value[0] == $value1[0] ) // checks whether date of record1 &amp; date of wiprecord equals then it will enter in the condition
    {
        array_push($record1[$key], $wiprecord[$key][1]); // this will put the contents in record1[]
        $get_first_array[$key] = $record1[$key]; // this record1 is gets transfer in another array
        print_r( $get_first_array[$key]);   
    }
 }
}
</code></pre>
