note 127222 deleted from function.fopen by crell

From: Date: Tue, 05 Jul 2022 19:45:13 +0000
Subject: note 127222 deleted from function.fopen by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218903@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- <?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; } } ?>

« previous php.notes (#218903) next »