note 127233 added to function.file
| From: | max dot bohrmann at gmx dot net | Date: | Thu, 07 Jul 2022 09:39:10 +0000 |
| Subject: | note 127233 added to function.file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-218917@lists.php.net to get a copy of this message | ||
<?php
/*------------------M A I N----------------------------*/
$data="logSkipass.txt";
$pass="00788";
if(getLiftLength($data,$pass)==-1){exit("<p>Datei nicht gefunden.</p>");}
echo "<p>Der Benutzer mit der PassID: ".$pass." hat insgesamt :
".getLiftLength($data,$pass)." m Liftstrecke benutzt</p>";
/* ---------------F U N C T I O N S--------------------*/
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);
//var_dump($rowArray);
//echo $rowArray[2]." --> ".$rowArray[5]."<br>";
if($rowArray[2]==$passID)
{
$liftLength+=(int)$rowArray[5]; //Typecast
}
}
fclose($fp);
return $liftLength;
}
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.133 (proxied: 2a02:810c:4cbf:f988:d4d7:e0b7:7bf8:6318)
----
Manual Page -- https://php.net/manual/en/function.file.php
Edit -- https://main.php.net/note/edit/127233
Del: integrated -- https://main.php.net/note/delete/127233/integrated
Del: useless -- https://main.php.net/note/delete/127233/useless
Del: bad code -- https://main.php.net/note/delete/127233/bad+code
Del: spam -- https://main.php.net/note/delete/127233/spam
Del: non-english -- https://main.php.net/note/delete/127233/non-english
Del: in docs -- https://main.php.net/note/delete/127233/in+docs
Del: other reasons-- https://main.php.net/note/delete/127233
Reject -- https://main.php.net/note/reject/127233
Search -- https://main.php.net/manage/user-notes.php