本文整理汇总了PHP中Math::floor方法的典型用法代码示例。如果您正苦于以下问题:PHP Math::floor方法的具体用法?PHP Math::floor怎么用?PHP Math::floor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Math
的用法示例。
在下文中一共展示了Math::floor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($baseURL, $number_of_results, $results_per_page)
{
if (!php_Boot::$skip_constructor) {
if ($results_per_page <= 0) {
throw new HException(new system_base_General_error(" results per page must be 1 or larger", 500, _hx_anonymous(array("fileName" => "Paginator.hx", "lineNumber" => 37, "className" => "system.base.Paginator", "methodName" => "new"))));
}
$full_pages = Math::floor($number_of_results / $results_per_page);
$spill_pages = system_base_Paginator_0($this, $baseURL, $full_pages, $number_of_results, $results_per_page);
$this->current_links = null;
$this->base_url = $baseURL;
$this->total_pages = $full_pages + $spill_pages;
}
}
示例2: base26
public function base26($num)
{
$alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if ($num < 0) {
return "-";
}
$out = "";
do {
$out = _hx_string_or_null($out) . _hx_string_or_null(_hx_char_at($alpha, _hx_mod($num, 26)));
$num = Math::floor($num / 26) - 1;
} while ($num >= 0);
return $out;
}
示例3: toString
public function toString()
{
$html = "";
$width = Math::floor(100 / $this->iframes->length) - 1;
$_g = 0;
$_g1 = $this->iframes;
while ($_g < $_g1->length) {
$iframeUrl = $_g1[$_g];
++$_g;
$html .= "\n\t" . "<iframe src=\"" . _hx_string_or_null($iframeUrl) . "\" style=\"width:" . Std::string($width) . "%; height:100%; margin:0px; padding:0px; border:1px solid;\"></iframe>";
unset($iframeUrl);
}
return ltrim($html);
}
示例4: create
static function create()
{
$s = new _hx_array(array());
$_g = 0;
while ($_g < 8) {
$i = $_g++;
$s[$i] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
unset($i);
}
$s[8] = "-";
$_g1 = 9;
while ($_g1 < 13) {
$i1 = $_g1++;
$s[$i1] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
unset($i1);
}
$s[13] = "-";
$s[14] = "4";
$_g2 = 15;
while ($_g2 < 18) {
$i2 = $_g2++;
$s[$i2] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
unset($i2);
}
$s[18] = "-";
$s[19] = "" . _hx_string_or_null(_hx_char_at("89AB", Math::floor(Math::random() * 4)));
$_g3 = 20;
while ($_g3 < 23) {
$i3 = $_g3++;
$s[$i3] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
unset($i3);
}
$s[23] = "-";
$_g4 = 24;
while ($_g4 < 36) {
$i4 = $_g4++;
$s[$i4] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
unset($i4);
}
return $s->join("");
}
示例5: binarySearch
static function binarySearch($v, $c)
{
$min = 0;
$max = $v->length - 1;
do {
$mid = Math::floor(($min + $max) / 2);
$cc = $v[$mid];
if ($c === $cc) {
return true;
} else {
if ($c < $cc) {
$max = $mid - 1;
} else {
$min = $mid + 1;
}
}
unset($mid, $cc);
} while ($min <= $max);
return false;
}
示例6: getTestPage
public function getTestPage()
{
$random = "" . _hx_string_rec(Math::floor(Math::random() * 9999), "");
$mml = "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mrow><msqrt><mn>" . $random . "</mn></msqrt></mrow></math>";
$testName = null;
$reportText = null;
$solutionLink = null;
$condition = null;
$output = "";
$output .= "<html><head>\r\n";
$output .= "<title>WIRIS plugin test page</title><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" /><style type=\"text/css\">/*<!--*/html {font-family: sans-serif;}h2 {margin-left: 1em;}h3 {margin-left: 2em;}p {margin-left: 3em;}p.concrete {margin-left: 4em;}.ok {font-weight: bold;color: #0c0;}.error {font-weight: bold;color: #f00;}/*-->*/</style><style type=\"text/css\">body{font-family: Arial;}span{font-weight: bold;}span.ok {color: #009900;}span.error {color: #dd0000;}table, th, td, tr {border: solid 1px #000000;border-collapse:collapse;padding: 5px;}th{background-color: #eeeeee;}img{border:none;}</style>\r\n";
$output .= "<script src=\"../core/WIRISplugins.js?viewer=image\" ></script>\r\n";
$output .= "</head><body><h1>WIRIS plugin test page</h1>\r\n";
$output .= "<table><tr><th>Test</th><th>Report</th><th>Status</th></tr>\r\n";
$testName = "WIRIS plugin version";
try {
$s = com_wiris_system_Storage::newResourceStorage("VERSION")->read();
$reportText = "<b>" . $s . "</b>";
$solutionLink = "";
$condition = true;
} catch (Exception $»e) {
$_ex_ = $»e instanceof HException ? $»e->e : $»e;
$ex = $_ex_;
$reportText = "Missing version";
$solutionLink = "";
$condition = false;
}
$output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition);
$testName = "Creating and storing data";
$solutionLink = "";
$param = array();
$outp = array();
$imageUrl = $this->plugin->newRender()->createImage($mml, $param, $outp);
$reportText = "<a href=\"" . $imageUrl . "\" />" . $imageUrl . "</a>";
$condition = true;
$output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition);
$testName = "Retrieving data";
$solutionLink = "";
$reportText = "<img src=\"" . $imageUrl . "\" />";
$output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition);
$testName = "JavaScript MathML filter";
$solutionLink = "";
$reportText = $mml;
$output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition);
$testName = "Host platform";
$solutionLink = "";
$platform = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$HOST_PLATFORM, "failed");
$reportText = $platform;
$output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition);
$testName = "Filter test";
$solutionLink = "";
$condition = true;
$p = null;
$p = array();
$p["savemode"] = "safeXml";
$s2 = str_replace("<", com_wiris_plugin_impl_TestImpl_0($this, $condition, $ex, $imageUrl, $mml, $outp, $output, $p, $param, $platform, $random, $reportText, $solutionLink, $testName), $mml);
$s2 = str_replace(">", com_wiris_plugin_impl_TestImpl_1($this, $condition, $ex, $imageUrl, $mml, $outp, $output, $p, $param, $platform, $random, $reportText, $s2, $solutionLink, $testName), $s2);
$s2 = str_replace("\"", com_wiris_plugin_impl_TestImpl_2($this, $condition, $ex, $imageUrl, $mml, $outp, $output, $p, $param, $platform, $random, $reportText, $s2, $solutionLink, $testName), $s2);
$reportText = $this->plugin->newTextService()->filter("square root: " . $s2, $p);
$output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition);
$testName = "Connecting to www.wiris.net";
$solutionLink = "";
$condition = true;
try {
$h = new com_wiris_plugin_impl_HttpImpl("http://www.wiris.net", null);
$h->request(true);
} catch (Exception $»e) {
$_ex_ = $»e instanceof HException ? $»e->e : $»e;
$ex2 = $_ex_;
$condition = false;
}
$reportText = "Checking if WIRIS server is reachable";
$output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition);
if (Type::resolveClass("com.wiris.editor.services.PublicServices") !== null) {
$condition = true;
$testName = "Testing integrated services";
$reportText = "WIRIS Services installed";
$solutionLink = "";
$output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition);
$isLicensed = $this->plugin->isEditorLicensed();
$condition = false;
$testName = "WIRIS editor license";
$reportText = "Checking WIRIS editor valid license";
$output .= $this->createTableRow($testName, $reportText, $solutionLink, $isLicensed);
} else {
$reportText = "WIRIS Services not installed";
}
$debug = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$DEBUG, "false") === "true";
if ($debug) {
$testName = "Font family";
$solutionLink = "";
$condition = true;
$reportText = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$FONT_FAMILY, "");
$output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition);
$testName = "Configuration file";
$solutionLink = "";
$condition = true;
$reportText = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$CONFIGURATION_PATH, "") . "\\configuration.ini";
$output .= $this->createTableRow($testName, $reportText, $solutionLink, $condition);
$testName = "Cache path";
//.........这里部分代码省略.........
示例7: isRedirect
public function isRedirect()
{
return Math::floor($this->status / 100) === 3;
}