-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
76 lines (71 loc) · 2.08 KB
/
index.php
File metadata and controls
76 lines (71 loc) · 2.08 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
$file1 = "csv/sample1.csv";
$file2 = "csv/sample2.csv";
//$file1 = "csv/20120517.csv";
//$file2 = "csv/20120530.csv";
$tss = microtime(true);
require_once 'csvdiffs.php';
/**
* rows in file-1 where col 1 not in file-2
*/
$difi1 = diffsCol($difR, $difR1, 1);
/**
* rows in file-2 where col 1 not in file-1
*/
$difi2 = diffsCol($difR1, $difR, 1);
/**
* rows in file-1 where col1 in file2 the same but other cols changed
*/
$difi3 = diffsUCol($difR, $difR1, 1);
/**
* rows in file-2 where col1 in file1 the same but other cols changed
*/
$difi4 = diffsUCol($difR1, $difR, 1);
$tse = microtime(true);
echo '<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title>csvDiffs.php Demo </title>
<style type="text/css">
body {
text-align: center;
}
p {margin:5px 0 5px;
}
li{
margin:8px 0 8px 10px;
}
.result{
display:block;
margin-left:10px;
color: #888;
font-family:curior;
}
#container {
width: 1000px;
margin: 0 auto;
margin-top: 50px;
text-align: left;
}
</style>
</head>
<body>';
echo '
<h1>csvDiffs.php Demo</h1>
<div id="container"><p>Time to process: '.round($tse-$tss, 5).' seconds</p>
<p>File-1: '.$file1.'</p>
<p>File-2: '.$file2.'</p>';
echo '<ul>
<li>Rows in file-1 with no exact match in file-2: <div class="result">'.stripcslashes(json_encode($difR)).'</div></li>
<li>Rows in file-2 with no exact match in file-1: <div class="result">'.stripcslashes(json_encode($difR1)).'</div></li>
<li>Rows in file-1 where col#1 not in file-2: <div class="result">'.stripcslashes(json_encode($difi1)).'</div></li>
<li>Rows in file-2 where col#1 not in file-1: <div class="result">'.stripcslashes(json_encode($difi2)).'</div></li>
<li>Rows in file-1 where col#1 in file-2 the same but other cols different: <div class="result">'.stripcslashes(json_encode($difi3)).'</div></li>
<li>Rows in file-2 where col#1 in file-1 the same but other cols different: <div class="result">'.stripcslashes(json_encode($difi4)).'</div></li>
</ul>';
echo '</div>
</body>
</html>';
?>