note 127223 deleted from function.fopen by crell
| From: | crell@php.net | Date: | Tue, 05 Jul 2022 19:45:26 +0000 |
| Subject: | note 127223 deleted from function.fopen by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218902@lists.php.net to get a copy of this message | ||
Note Submitter: wvss at gmail dot com
----
<?php
$data="./logSkipass.txt";
$pass="28774";
if(getLiftLength($data,$pass)==-1)
{exit("Datei nicht gefunden.");}
echo "<p>Der Benutzer mit der PassID: ".$pass." hat insgesamt : "
.getLiftLength($data,$pass)." m Liftstrecke benutzt</p>";
function getLiftLength ($dataname,$passID) :int
{
$LiftLength=0;
if (!file_exists($dataname))
{
return -1;
}
else
{
$fp=fopen($dataname,"r");
while(!feof($fp))
{
$row=fgets($fp);
$rowarray=explode("|",$row);
//echo $rowarray[2]. " --> ".$rowarray[5]. "<br>";
if($rowarray[2]==$passID)
{
$LiftLength+=(int)$rowarray[5]; //Typecast
}
}
fclose($fp);
return $LiftLength;
}
}
?>