asked on
ID|TYPE|DATE
123|XYZ|2017-03-07
123|ABC|2017-03-08
124|XYZ|2017-03-08
<?php
error_reporting(E_ALL);
$Data = explode('|', file_get_contents("log.txt"));
trace($Data);
$ID = 123;
if($Data[$ID]){
echo "found $ID";
}
function trace($arr){
echo "<pre>";
print_r($arr);
echo "</pre>";
}//end trace
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
ASKER
The log file currently doesn't exist so can be in what ever format I want but is likely to grow daily as each time the application is run new lines will be created maybe 10 per day.
Maybe I need further explanation
each time it's run a directory is read with 1 or more files in
within each file a ID and TYPE is read
I need to test it hasn't been processed before potentially the same ID can be used up to 3 times depending on type however the vast majority will be once
so I would open the log file once and as I read the directory test if that file ID / TYPE has been processed before if not then process the file