/
compare.php
50 lines (38 loc) · 860 Bytes
/
compare.php
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
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
// QA generated files
set_time_limit(100000);
$master = new SplFileObject("Merged.csv");
$master->setFlags(SplFileObject::READ_CSV);
foreach ($master as $row) {
$master_row[] = $row;
}
// Combine arrays
//
$arr = array_merge( $master_row );
// Sort the merged array
function val_sort($array,$key) {
// Loop through and get the values of our specified key
foreach($array as $k=>$v) {
$b[] = strtolower($v[$key]);
}
asort($b);
foreach($b as $k=>$v) {
$c[] = $array[$k];
}
return $c;
}
// Sort by email (col 2)
$sorted = val_sort($arr, '2');
// Loop through files to QA file outputs
//
echo '<hr><table>';
foreach($sorted as $unique_row) {
echo '<tr>';
foreach($unique_row as $element) {
echo '<td>' . $element . '</td>';
}
echo '</tr>';
}
echo '</table>';
echo '<br />';
?>