forked from paulovitorbal/world-cup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiff.php
More file actions
37 lines (27 loc) · 758 Bytes
/
diff.php
File metadata and controls
37 lines (27 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
$file[0] = '/data/projects/techsessions/world-cup/worldcup.teams.json';
$file[1] = '/data/projects/techsessions/world-cup/worldcup.teams-2.json';
$filec[0] = file_get_contents($file[0]);
$filec[1] = file_get_contents($file[1]);
$data[0] = json_decode($filec[0], 1);
$data[1] = json_decode($filec[1], 1);
$t[0] = [];
$t[1] = [];
foreach($data[0]['teams'] as $team) {
@$t[0][$team['name']]++;
}
foreach($data[1]['teams'] as $team) {
@$t[1][$team['name']]++;
}
$singles = [];
foreach($t[0] as $name => $dummy) {
if(!isset($t[1][$name])) {
@$singles[$name . ' case 1']++;
}
}
foreach($t[1] as $name => $dummy) {
if(!isset($t[0][$name])) {
@$singles[$name . ' case 2']++;
}
}
print_r(array_keys($singles));