Merging arrays PHP

I have two arrays of data:

array(2) {
  ["12:15"]=>
  string(84) "http://form.horseracing.betfair.com/horse-racing/010108/Catterick_Bridge-GB-Cat/1215"
  ["12:20"]=>
  string(77) "http://form.horseracing.betfair.com/horse-racing/010108/Southwell-GB-Sou/1220"
}

and

array(2) {
  ["12:15"]=>
  string(90) "http://www.racingpost.com/horses/result_home.sd?race_id=446323&r_date=2008-01-01&popup=yes"
  ["12:20"]=>
  string(90) "http://www.racingpost.com/horses/result_home.sd?race_id=446250&r_date=2008-01-01&popup=yes"
}

I want to merge these based on time, so I end up with an array of values where times in both arrays match only.

array(2) {
  ["12:15"]=>
  array(2) {
    [0]=>
    string(84) "http://form.horseracing.betfair.com/horse-racing/010108/Catterick_Bridge-GB-Cat/1215"
    [1]=>
    string(90) "http://www.racingpost.com/horses/result_home.sd?race_id=446323&r_date=2008-01-01&popup=yes"
  }
  ["12:20"]=>
  array(2) {
    [0]=>
    string(77) "http://form.horseracing.betfair.com/horse-racing/010108/Southwell-GB-Sou/1220"
    [1]=>
    string(90) "http://www.racingpost.com/horses/result_home.sd?race_id=446250&r_date=2008-01-01&popup=yes"
  }
}

Answers


Wouldn't the following do trick?

$arr1 = array('time' => '14:00', 'rp' => 'blah');
$arr2 = array('time' => '14:00', 'bf' => 'yadda');

if ($arr1['time'] === $arr2['time']) {
    $mergedArray = array_merge($arr1, $arr2);
}

Need Your Help

Creating fonts from *.ttf files using iText

java fonts resources itext

This is a method inside my Resources.class:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.