Created
January 22, 2012 01:47
-
-
Save koo5/1655036 to your computer and use it in GitHub Desktop.
pohoda <> fio cvs diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fio = array(); | |
$a = fopen("dz-pohyby.cgi", "r"); | |
for($i=0;$i<10;$i++) | |
fgets($a); | |
while($b=fgets($a)) | |
$fio[] = explode(";", $b); | |
$fio=array_splice($fio,0,sizeof($fio)-2); | |
for($i=0;$i<sizeof($fio);$i++) | |
$fio[$i] = array(date_create( $fio[$i][1])->getTimestamp(), preg_replace("/ /", "", $fio[$i][2])); | |
$pohoda = array(); | |
$a = fopen("banka.txt", "r"); | |
while($b=fgets($a)) | |
$pohoda[] = explode(";", $b); | |
$pohoda=array_splice($pohoda, 1); | |
for($i=0;$i<sizeof($pohoda);$i++) | |
{ | |
$p = $pohoda[$i]; | |
$lolatphp=explode(" ",$p[32]); | |
$pohoda[$i]= array(date_create($lolatphp[0])->getTimestamp(), ($p[15][1]==='V'? "-":""). substr($p[38],0,-3)); | |
} | |
function cmp($a,$b) | |
{ | |
if ($a[0] == $b[0]) | |
{ | |
if($a[1]==$b[1]) | |
return 0; | |
else if ($a[1]<$b[1]) | |
return -1; | |
else return 1; | |
} | |
else if ($a[0]<$b[0]) | |
return -1; | |
else return 1; | |
} | |
//print_r($pohoda); | |
usort($pohoda, "cmp"); | |
usort($fio, "cmp"); | |
$po = fopen("pohoda", "w"); | |
foreach ($pohoda as $b) | |
{ | |
$d = getdate($b[0]); | |
// print_r($d); | |
fwrite($po, $d['year']." ".$d['mon']." ".$d['mday']." ".$b[1]."\n"); | |
} | |
$fi = fopen("fio", "w"); | |
foreach ($fio as $b) | |
{ | |
// print_r($b); | |
$d =getdate($b[0]); | |
fwrite($fi, $d['year']." ".$d['mon']." ".$d['mday']." ".$b[1]."\n"); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment