本文整理汇总了PHP中Std::int方法的典型用法代码示例。如果您正苦于以下问题:PHP Std::int方法的具体用法?PHP Std::int怎么用?PHP Std::int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Std
的用法示例。
在下文中一共展示了Std::int方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setTimeout
public function setTimeout($timeout)
{
$s = Std::int($timeout);
$ms = Std::int(($timeout - $s) * 1000000);
$r = stream_set_timeout($this->__s, $s, $ms);
sys_net_Socket::checkError($r, 0, "Unable to set timeout");
}
示例2: snapMonth
static function snapMonth($dt, $direction)
{
$month = null;
$days = Std::int(($dt - 62135596800.0 - datetime__DateTime_DateTime_Impl_::yearStart($dt)) / 86400) + 1;
$month = datetime_utils_DateTimeMonthUtils::getMonth($days, datetime__DateTime_DateTime_Impl_::isLeapYear($dt));
$isLeap = datetime__DateTime_DateTime_Impl_::isLeapYear($dt);
switch ($direction) {
case -1:
return datetime__DateTime_DateTime_Impl_::yearStart($dt) + datetime_utils_DateTimeMonthUtils::toSeconds($month, $isLeap);
break;
case 1:
return datetime__DateTime_DateTime_Impl_::yearStart($dt) + datetime_utils_DateTimeMonthUtils::toSeconds($month, $isLeap) + datetime_utils_DateTimeMonthUtils::days($month, $isLeap) * 86400;
break;
case 0:
$previous = datetime__DateTime_DateTime_Impl_::yearStart($dt) + datetime_utils_DateTimeMonthUtils::toSeconds($month, $isLeap);
$next = datetime__DateTime_DateTime_Impl_::yearStart($dt) + datetime_utils_DateTimeMonthUtils::toSeconds($month, $isLeap) + datetime_utils_DateTimeMonthUtils::days($month, $isLeap) * 86400;
if ($next - ($dt - 62135596800.0) > $dt - 62135596800.0 - $previous) {
return $previous;
} else {
return $next;
}
break;
}
}
示例3: parseRec
//.........这里部分代码省略.........
if (haxe_format_JsonParser_3($this, $c, $save1) !== 97 || haxe_format_JsonParser_4($this, $c, $save1) !== 108 || haxe_format_JsonParser_5($this, $c, $save1) !== 115 || haxe_format_JsonParser_6($this, $c, $save1) !== 101) {
$this->pos = $save1;
$this->invalidChar();
}
return false;
break;
case 110:
$save2 = $this->pos;
if (haxe_format_JsonParser_7($this, $c, $save2) !== 117 || haxe_format_JsonParser_8($this, $c, $save2) !== 108 || haxe_format_JsonParser_9($this, $c, $save2) !== 108) {
$this->pos = $save2;
$this->invalidChar();
}
return null;
break;
case 34:
return $this->parseString();
break;
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
case 45:
$c3 = $c;
$start = $this->pos - 1;
$minus = $c3 === 45;
$digit = !$minus;
$zero = $c3 === 48;
$point = false;
$e = false;
$pm = false;
$end = false;
while (true) {
$index13 = $this->pos++;
$c3 = ord(substr($this->str, $index13, 1));
unset($index13);
switch ($c3) {
case 48:
if ($zero && !$point) {
$this->invalidNumber($start);
}
if ($minus) {
$minus = false;
$zero = true;
}
$digit = true;
break;
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
if ($zero && !$point) {
$this->invalidNumber($start);
}
if ($minus) {
$minus = false;
示例4: toString
static function toString($this1)
{
$Y = datetime__DateTime_DateTime_Impl_::getYear($this1);
$M = null;
$days = Std::int(($this1 - 62135596800.0 - datetime__DateTime_DateTime_Impl_::yearStart($this1)) / 86400) + 1;
$M = datetime_utils_DateTimeMonthUtils::getMonth($days, datetime__DateTime_DateTime_Impl_::isLeapYear($this1));
$D = null;
$days1 = Std::int(($this1 - 62135596800.0 - datetime__DateTime_DateTime_Impl_::yearStart($this1)) / 86400) + 1;
$D = datetime_utils_DateTimeMonthUtils::getMonthDay($days1, datetime__DateTime_DateTime_Impl_::isLeapYear($this1));
$h = Std::int(($this1 - Math::ffloor($this1 / 86400) * 86400) / 3600);
$m = Std::int(($this1 - Math::ffloor($this1 / 3600) * 3600) / 60);
$s = Std::int($this1 - Math::ffloor($this1 / 60) * 60);
return "" . _hx_string_rec($Y, "") . "-" . _hx_string_or_null(datetime__DateTime_DateTime_Impl__4($D, $M, $Y, $h, $m, $s, $this1)) . "-" . _hx_string_or_null(datetime__DateTime_DateTime_Impl__5($D, $M, $Y, $h, $m, $s, $this1)) . " " . _hx_string_or_null(datetime__DateTime_DateTime_Impl__6($D, $M, $Y, $h, $m, $s, $this1)) . ":" . _hx_string_or_null(datetime__DateTime_DateTime_Impl__7($D, $M, $Y, $h, $m, $s, $this1)) . ":" . _hx_string_or_null(datetime__DateTime_DateTime_Impl__8($D, $M, $Y, $h, $m, $s, $this1));
}
示例5: pickSizes
public function pickSizes($t)
{
$w = $t->get_width();
$h = $t->get_height();
$v = $t->getCellView();
$csv = new coopy_Csv(null);
$sizes = new _hx_array(array());
$row = -1;
$total = $w - 1;
$_g = 0;
while ($_g < $w) {
$x = $_g++;
$m = 0;
$m2 = 0;
$mmax = 0;
$mmostmax = 0;
$mmin = -1;
$_g1 = 0;
while ($_g1 < $h) {
$y = $_g1++;
$txt = $this->getText($x, $y, false);
if ($txt === "@@" && $row === -1) {
$row = $y;
}
$len = strlen($txt);
if ($y === $row) {
$mmin = $len;
}
$m += $len;
$m2 += $len * $len;
if ($len > $mmax) {
$mmax = $len;
}
unset($y, $txt, $len);
}
unset($_g1);
$mean = $m / $h;
$stddev = Math::sqrt($m2 / $h - $mean * $mean);
$most = Std::int($mean + $stddev * 2 + 0.5);
$_g11 = 0;
while ($_g11 < $h) {
$y1 = $_g11++;
$txt1 = $this->getText($x, $y1, false);
$len1 = strlen($txt1);
if ($len1 <= $most) {
if ($len1 > $mmostmax) {
$mmostmax = $len1;
}
}
unset($y1, $txt1, $len1);
}
unset($_g11);
$full = $mmax;
$most = $mmostmax;
if ($mmin !== -1) {
if ($most < $mmin) {
$most = $mmin;
}
}
$sizes->push($most);
$total += $most;
unset($x, $stddev, $most, $mmostmax, $mmin, $mmax, $mean, $m2, $m, $full);
}
if ($total > 130) {
return null;
}
return $sizes;
}
示例6: getTotalWeeks
public function getTotalWeeks()
{
return Std::int(($this->end - 62135596800.0 - ($this->begin - 62135596800.0)) / 604800);
}
示例7: setCookie
static function setCookie($key, $value, $expire = null, $domain = null, $path = null, $secure = null, $httpOnly = null)
{
$t = null;
if ($expire === null) {
$t = 0;
} else {
$t = Std::int($expire->getTime() / 1000.0);
}
if ($path === null) {
$path = "/";
}
if ($domain === null) {
$domain = "";
}
if ($secure === null) {
$secure = false;
}
if ($httpOnly === null) {
$httpOnly = false;
}
setcookie($key, $value, $t, $path, $domain, $secure, $httpOnly);
}
示例8: strftime
static function strftime($dt, $format)
{
$prevPos = 0;
$pos = _hx_index_of($format, "%", null);
$str = "";
while ($pos >= 0) {
$str .= _hx_string_or_null(_hx_substring($format, $prevPos, $pos));
$pos++;
$_g = ord(substr($format, $pos, 1));
switch ($_g) {
case 100:
$s = null;
$s = _hx_string_rec(datetime_utils_DateTimeUtils_5($_g, $dt, $format, $pos, $prevPos, $s, $str), "") . "";
if (strlen("0") === 0 || strlen($s) >= 2) {
$str .= _hx_string_or_null($s);
} else {
$str .= _hx_string_or_null(str_pad($s, Math::ceil((2 - strlen($s)) / strlen("0")) * strlen("0") + strlen($s), "0", STR_PAD_LEFT));
}
break;
case 101:
$s1 = null;
$s1 = _hx_string_rec(datetime_utils_DateTimeUtils_6($_g, $dt, $format, $pos, $prevPos, $s1, $str), "") . "";
if (strlen(" ") === 0 || strlen($s1) >= 2) {
$str .= _hx_string_or_null($s1);
} else {
$str .= _hx_string_or_null(str_pad($s1, Math::ceil((2 - strlen($s1)) / strlen(" ")) * strlen(" ") + strlen($s1), " ", STR_PAD_LEFT));
}
break;
case 106:
$day = Std::int(($dt - 62135596800.0 - datetime__DateTime_DateTime_Impl_::yearStart($dt)) / 86400) + 1;
$s2 = "" . _hx_string_rec($day, "");
if (strlen("0") === 0 || strlen($s2) >= 3) {
$str .= _hx_string_or_null($s2);
} else {
$str .= _hx_string_or_null(str_pad($s2, Math::ceil((3 - strlen($s2)) / strlen("0")) * strlen("0") + strlen($s2), "0", STR_PAD_LEFT));
}
break;
case 117:
$str .= _hx_string_rec(datetime__DateTime_DateTime_Impl_::getWeekDay($dt, true), "") . "";
break;
case 119:
$str .= _hx_string_rec(datetime__DateTime_DateTime_Impl_::getWeekDay($dt, null), "") . "";
break;
case 109:
$s3 = null;
$s3 = _hx_string_rec(datetime_utils_DateTimeUtils_7($_g, $dt, $format, $pos, $prevPos, $s3, $str), "") . "";
if (strlen("0") === 0 || strlen($s3) >= 2) {
$str .= _hx_string_or_null($s3);
} else {
$str .= _hx_string_or_null(str_pad($s3, Math::ceil((2 - strlen($s3)) / strlen("0")) * strlen("0") + strlen($s3), "0", STR_PAD_LEFT));
}
break;
case 67:
$s4 = _hx_string_rec(Std::int(datetime__DateTime_DateTime_Impl_::getYear($dt) / 100), "") . "";
if (strlen("0") === 0 || strlen($s4) >= 2) {
$str .= _hx_string_or_null($s4);
} else {
$str .= _hx_string_or_null(str_pad($s4, Math::ceil((2 - strlen($s4)) / strlen("0")) * strlen("0") + strlen($s4), "0", STR_PAD_LEFT));
}
break;
case 121:
$s5 = _hx_substr(_hx_string_rec(datetime__DateTime_DateTime_Impl_::getYear($dt), "") . "", -2, null);
if (strlen("0") === 0 || strlen($s5) >= 2) {
$str .= _hx_string_or_null($s5);
} else {
$str .= _hx_string_or_null(str_pad($s5, Math::ceil((2 - strlen($s5)) / strlen("0")) * strlen("0") + strlen($s5), "0", STR_PAD_LEFT));
}
break;
case 89:
$str .= _hx_string_rec(datetime__DateTime_DateTime_Impl_::getYear($dt), "") . "";
break;
case 86:
$s6 = _hx_string_rec(datetime__DateTime_DateTime_Impl_::getWeek($dt), "") . "";
if (strlen("0") === 0 || strlen($s6) >= 2) {
$str .= _hx_string_or_null($s6);
} else {
$str .= _hx_string_or_null(str_pad($s6, Math::ceil((2 - strlen($s6)) / strlen("0")) * strlen("0") + strlen($s6), "0", STR_PAD_LEFT));
}
break;
case 72:
$s7 = _hx_string_rec(Std::int(($dt - Math::ffloor($dt / 86400) * 86400) / 3600), "") . "";
if (strlen("0") === 0 || strlen($s7) >= 2) {
$str .= _hx_string_or_null($s7);
} else {
$str .= _hx_string_or_null(str_pad($s7, Math::ceil((2 - strlen($s7)) / strlen("0")) * strlen("0") + strlen($s7), "0", STR_PAD_LEFT));
}
break;
case 107:
$s8 = _hx_string_rec(Std::int(($dt - Math::ffloor($dt / 86400) * 86400) / 3600), "") . "";
if (strlen(" ") === 0 || strlen($s8) >= 2) {
$str .= _hx_string_or_null($s8);
} else {
$str .= _hx_string_or_null(str_pad($s8, Math::ceil((2 - strlen($s8)) / strlen(" ")) * strlen(" ") + strlen($s8), " ", STR_PAD_LEFT));
}
break;
case 73:
$s9 = _hx_string_rec(datetime__DateTime_DateTime_Impl_::getHour12($dt), "") . "";
if (strlen("0") === 0 || strlen($s9) >= 2) {
$str .= _hx_string_or_null($s9);
} else {
//.........这里部分代码省略.........