} else { if ($sumsum2 > $record2) { file_put_contents($record, $sumsum2); } } $record3 = file_get_contents($record); echo "Max: " . $record3 . " @ " . date("Y-m-d, H:i:s", filemtime($record)); echo "<br>"; $chan31 = sum3('sc1.readycast.org:8888', '8888'); $chan32 = sum3('89.248.166.198:8017', '8017'); $chan33 = sum3('sc1.readycast.org:8026', '8026'); $chan34 = sum3('sc1.readycast.org:8558', '8558'); $chan35 = sum3('sc1.readycast.org:8440', '8440'); $chan36 = sum3('sc1.readycast.org:8544', '8544'); $chan37 = sum3('esr.rootnode.net:8019', '8019'); $chan38 = sum3('esr.rootnode.net:8021', '8021'); $sumsum3 = $chan31 + $chan32 + $chan33 + $chan34 + $chan35 + $chan36 + $chan37 + $chan38; echo "Slots: " . $sumsum3; $usage2 = $sumsum2 / ($sumsum3 / 10) * 10; $czo2 = round($usage2, 2); echo "<br>Usage: {$czo2}%<br><br>\n"; $dzis = date(Ymd); $filename = "history/" . $dzis . ".txt"; $dzis2 = date("Y-m-d"); $nowtime = date("H:i:s"); $sumsum3b = $nowtime . " " . $chan21 . " " . $chan22 . " " . $chan23 . " " . $chan24 . " " . $chan25 . " " . $chan26 . " " . $chan27 . " " . $sumsum2 . "\n"; if (!file_exists($filename)) { touch($filename); file_put_contents($filename, $sumsum3b, FILE_APPEND); } else { file_put_contents($filename, $sumsum3b, FILE_APPEND);
<?php function sum3($nums) { echo array_sum($nums); } sum3([1, 2, 3]); sum3([5, 11, 2]); sum3([7, 0, 0]);