Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $injuryData = file_get_contents('http://football.myfantasyleague.com/2013/export?TYPE=injuries&L=&W=&JSON=1&callback=');
- $array1 = json_decode($injuryData, true);
- $playerData = file_get_contents('http://football.myfantasyleague.com/2013/export?TYPE=players&L=&W=&JSON=1');
- $array2 = json_decode($playerData, true);
- function map($x) {
- global $array1;
- if(isset($x['id'])) {
- $id = $x['id'];
- $valid = array_filter($array1['injuries']['injury'], create_function('$injury', 'return $injury["id"] == "' . $id .'";'));
- if(count($valid) > 0) {
- $x = array_merge($x, array_shift($valid));
- }
- }
- return $x;
- }
- $output = array_map('map', $array2['players']['player']);
- print_r($output);
Advertisement
Add Comment
Please, Sign In to add comment