To determine the exact number of lines in a file I currently use:
if(exec("wc -l ".escapeshellarg($strFile), $arResult)) {
$arNum = explode(" ", $arResult[0]);
// ...
}
What is the best way of doing the same on Windows?
Edit:
One attempt from another question:
$file="largefile.txt";
$linecount = 0;
$handle = fopen($file, "r");
while(!feof($handle)){
$line = fgets($handle);
$linecount++;
}
fclose($handle);
echo $linecount;
Has anyone got experience with this way using big files?
Is there a way of using Windows commands to determine file size other then PHP functions?
Solution
I go with command find
as recommended by the accepted answer in the comments.