I made a script to read an uploaded file and search for certain patterns. There are two patterns it looks for and then are outputed. Problem is that $empo, the first output, does not display with "\n"; however the $checkso does use the \n newlines.
Am I doing something wrong?
// if the upload succeded, the file will exist
if (file_exists($tmp_name)){
// check to make sure that it is an uploaded file and not a system file
if(is_uploaded_file($tmp_name)){
// open the file for a binary read
$file = fopen($tmp_name,'rb');
// read the file content into a variable
$data = fread($file,filesize($tmp_name));
// close the file
fclose($file);
// now we encode it and split it into acceptable length lines
//$data = chunk_split(base64_encode($data));
}
$data = explode("\n",$data);
foreach ($data as $dataa) {
if ($dataa=="")
break;
preg_match_all("/[0-9]{0,9}\*[0-9]{0,5}[0-9zA-Zz\s\.\,\/\_\-\#\*]{1,400}/",$dataa,$emp);
preg_match_all("/[0-9]{1,3}+\s{1}+[0-9]{1,3}+\s[0-9zA-Zz\s\.\/\_\-\*]{30,400}/",$dataa,$checks);
$empo[] = implode ("", $emp[0]);
$checkso[] = implode ("", $checks[0]);
}
echo "\n";
if ($empo<>"") { $empo =implode("",$empo); echo "$empo \n"; }
echo "=-=-=-=-=-=-\n";
if ($checkso<>"") { $checkso =implode("",$checkso); echo "$checkso \n"; }
}