and another one which looks like thisStanza 07,41912087207
Stanza 08,41912087208
Stanza 09,41912087209
So I want to take ID value from the first file, check if it exists in the second csv file and if it does, print out values after the sixth comma, in lines above so it would be 500.12 since there is one ID that appears on both of CSV files 41912087207.0101*200,0789240959,centralino,101,2016-03-03 14:02:35,281,1.47,,4178,"La Perla" <41917913577>
0101*200,0789240959,centralino,101,2016-03-03 14:02:35,281,500.12,,4178,"La Perla" <41912087207>
0101*200,0917911974,centralino,101,2016-03-03 14:52:16,0,0,,41,"La Perla" <41917913577>
Here is my code
Code: Select all
<?PHP
$search= "41912087207";
$linescdr = file('cdr.txt');
$linesstanze = file('stanze.txt');
while (list($key, $line1) = each($linesstanze)) {
$arrr = explode(",", $line1);
while (list($key, $line) = each($linescdr)) {
if(strpos($line, $arrr[1])){
$arr = explode(",", $line);
echo $arr[6];
echo "<br>";
}
}
}
?>Code: Select all
if(strpos($line, $arrr[1])){