コード例 #1
0
ファイル: versus.php プロジェクト: BenBergman/gameai-2014-09
{
    if ($n == 0) {
        $p = 0;
    } else {
        $p = $m / $n * 100;
    }
    return number_format($p, 2, '.', '');
}
$html = file_get_contents("versus.html");
$html = str_replace("{{name1}}", $bot1["name"], $html);
$html = str_replace("{{name2}}", $bot2["name"], $html);
$html = str_replace("{{id1}}", $bot1["id"], $html);
$html = str_replace("{{id2}}", $bot2["id"], $html);
$html = str_replace("{{status1}}", $status1, $html);
$html = str_replace("{{status2}}", $status2, $html);
$html = str_replace("{{games}}", $games, $html);
$html = str_replace("{{total}}", $row["total"], $html);
$html = str_replace("{{wins}}", $row["wins"], $html);
$html = str_replace("{{wins-pct}}", pct($row["wins"], $row["total"]), $html);
$html = str_replace("{{losses}}", $row["losses"], $html);
$html = str_replace("{{losses-pct}}", pct($row["losses"], $row["total"]), $html);
$html = str_replace("{{ties}}", $row["ties"], $html);
$html = str_replace("{{ties-pct}}", pct($row["ties"], $row["total"]), $html);
$html = str_replace("{{forfeits}}", $row["forfeits"], $html);
$html = str_replace("{{forfeits-pct}}", pct($row["forfeits"], $row["total"]), $html);
// Remove any unused replacements.
$html = preg_replace("/\\{\\{[-_a-z0-9]*\\}\\}/i", "", $html);
// Dump the filled-in template to the browser.
header("Content-type: text/html");
echo $html;
exit;
コード例 #2
0
ファイル: xhprof.php プロジェクト: bdlangton/xhprof-1
function print_symbol_summary($symbol_info, $stat, $base)
{
    $val = $symbol_info[$stat];
    $desc = str_replace("<br>", " ", stat_description($stat));
    print "{$desc}: </td>";
    print number_format($val);
    print " (" . pct($val, $base) . "% of overall)";
    if (substr($stat, 0, 4) == "excl") {
        $func_base = $symbol_info[str_replace("excl_", "", $stat)];
        print " (" . pct($val, $func_base) . "% of this function)";
    }
    print "<br>";
}
コード例 #3
0
ファイル: index.php プロジェクト: LinEvil/timings
 if ($sample) {
     echo " - Sample Time: " . round($sample / 1000 / 1000 / 1000, 3) . 's';
 }
 if ($version) {
     echo "  - Spigot Version: {$version}\n";
 }
 $activatedPercent = 1;
 if ($activatedEntityTicks && $numTicks) {
     echo "Average Entities: ";
     $activatedAvgEntities = $activatedEntityTicks / $numTicks;
     $totalAvgEntities = $entityTicks / $numTicks;
     $activatedPercent = $activatedAvgEntities / $totalAvgEntities;
     if ($totalAvgEntities > 800 && $activatedPercent > 0.7) {
         $highEntityTick = true;
     }
     $activatedPercent = pct($activatedPercent, 1, 5, 75, 60, 50);
     echo number_format($activatedAvgEntities, 2);
     echo ' / ';
     echo number_format($totalAvgEntities, 2);
     echo " ({$activatedPercent})";
 } else {
     if ($entityTicks && $numTicks) {
         echo " - Average Entities: " . number_format($entityTicks / $numTicks, 2);
     }
 }
 if ($playerTicks && $numTicks) {
     echo " - Average Players: " . number_format($playerTicks / $numTicks, 2);
 }
 if ($numTicks && $sample) {
     $desiredTicks = $sample / 1000 / 1000 / 1000 * 20;
     echo " - Average TPS: " . number_format($numTicks / $desiredTicks * 20, 2);