Guest User

Untitled

a guest
Aug 28th, 2013
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2. $injuryData = file_get_contents('http://football.myfantasyleague.com/2013/export?TYPE=injuries&L=&W=&JSON=1&callback=');
  3. $array1 = json_decode($injuryData, true);
  4. $playerData = file_get_contents('http://football.myfantasyleague.com/2013/export?TYPE=players&L=&W=&JSON=1');
  5. $array2 = json_decode($playerData, true);
  6.  
  7. function map($x) {
  8.    global $array1;
  9.    if(isset($x['id'])) {
  10.       $id = $x['id'];
  11.       $valid = array_filter($array1['injuries']['injury'], create_function('$injury', 'return $injury["id"] == "' . $id .'";'));
  12.       if(count($valid) > 0) {
  13.          $x = array_merge($x, array_shift($valid));
  14.       }
  15.    }
  16.    return $x;
  17. }
  18. $output = array_map('map', $array2['players']['player']);
  19. print_r($output);
Advertisement
Add Comment
Please, Sign In to add comment