本文整理汇总了PHP中Std::parseFloat方法的典型用法代码示例。如果您正苦于以下问题:PHP Std::parseFloat方法的具体用法?PHP Std::parseFloat怎么用?PHP Std::parseFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Std
的用法示例。
在下文中一共展示了Std::parseFloat方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: math2Img
public function math2Img($str, $prop)
{
$img = "<img";
$output = array();
$prop["centerbaseline"] = "false";
$prop["accessible"] = "true";
$prop["metrics"] = "true";
$src = $this->render->createImage($str, $prop, $output);
$img .= " src=\"" . $src . "\"";
$alt = com_wiris_system_PropertiesTools::getProperty($output, "alt", null);
$width = com_wiris_system_PropertiesTools::getProperty($output, "width", null);
$height = com_wiris_system_PropertiesTools::getProperty($output, "height", null);
$baseline = com_wiris_system_PropertiesTools::getProperty($output, "baseline", null);
$dpi = Std::parseFloat($this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$WIRIS_DPI, "96"));
$mml = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$FILTER_OUTPUT_MATHML, "false") === "true";
$f = 96 / $dpi;
$dwidth = $f * Std::parseFloat($width);
$dheight = $f * Std::parseFloat($height);
$dbaseline = $f * Std::parseFloat($baseline);
$alt = $this->html_entity_encode($alt);
$img .= " class=\"Wirisformula\"";
$img .= " alt=\"" . $alt . "\"";
$img .= " width=\"" . _hx_string_rec($dwidth, "") . "\"";
$img .= " height=\"" . _hx_string_rec($dheight, "") . "\"";
$d = $dbaseline - $dheight;
$img .= " style=\"vertical-align:" . _hx_string_rec($d, "") . "px\"";
if ($mml) {
$tag = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_MATHML_ATTRIBUTE, "data-mathml");
$img .= " " . $tag . "=\"" . $this->save_xml_encode($str) . "\"";
}
$img .= "/>";
return $img;
}
示例2: readFloat
public function readFloat()
{
$p1 = $this->pos;
while (true) {
$c = ord(substr($this->buf, $this->pos, 1));
if ($c >= 43 && $c < 58 || $c === 101 || $c === 69) {
$this->pos++;
} else {
break;
}
unset($c);
}
return Std::parseFloat(_hx_substr($this->buf, $p1, $this->pos - $p1));
}
示例3: get_value
public function get_value()
{
$v = null;
if ($this->table->_values !== null) {
if (_hx_has_field($this->table->_values, $this->refName)) {
if ($this->isInt) {
$v = Std::parseInt(Reflect::field($this->table->_values, $this->refName));
} else {
if ($this->isFloat) {
$v = Std::parseFloat(Reflect::field($this->table->_values, $this->refName));
} else {
$v = Reflect::field($this->table->_values, $this->refName);
}
}
}
} else {
$v = $this->value;
}
return $v;
}
示例4: buildCond
public function buildCond($whereParam, $sob, $phValues, $first = null)
{
if ($first === null) {
$first = true;
}
$sb = new StringBuf();
$where = _hx_explode(",", $whereParam);
if ($where->length === 0) {
return false;
}
$_g = 0;
while ($_g < $where->length) {
$w = $where[$_g];
++$_g;
$wData = _hx_string_call($w, "split", array("|"));
$values = $wData->slice(2, null);
$filter_tables = null;
if (Util::any2bool($this->param) && $this->param->exists("filter_tables") && Util::any2bool($this->param->get("filter_tables"))) {
$jt = $this->param->get("filter_tables");
$filter_tables = _hx_explode(",", $jt);
unset($jt);
}
haxe_Log::trace(Std::string($wData) . ":" . _hx_string_or_null($this->joinTable) . ":" . Std::string($filter_tables), _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 386, "className" => "Model", "methodName" => "buildCond")));
if (_hx_deref(new EReg("^pay_[a-zA-Z_]+\\.", ""))->match($wData[0]) && _hx_array_get(_hx_explode(".", $wData[0]), 0) !== $this->joinTable) {
continue;
}
if ($first) {
$sb->add(" WHERE ");
} else {
$sb->add(" AND ");
}
$first = false;
$_g1 = strtoupper($wData[1]);
switch ($_g1) {
case "BETWEEN":
if (!($values->length === 2) && Lambda::hforeach($values, array(new _hx_lambda(array(&$_g, &$_g1, &$filter_tables, &$first, &$phValues, &$sb, &$sob, &$values, &$w, &$wData, &$where, &$whereParam), "Model_13"), 'execute'))) {
S::hexit("BETWEEN needs 2 values - got only:" . _hx_string_or_null($values->join(",")));
}
$sb->add($this->quoteField($wData[0]));
$sb->add(" BETWEEN ? AND ?");
$phValues->push(new _hx_array(array($wData[0], $values[0])));
$phValues->push(new _hx_array(array($wData[0], $values[1])));
break;
case "IN":
$sb->add($this->quoteField($wData[0]));
$sb->add(" IN(");
$sb->add($values->map(array(new _hx_lambda(array(&$_g, &$_g1, &$filter_tables, &$first, &$phValues, &$sb, &$sob, &$values, &$w, &$wData, &$where, &$whereParam), "Model_14"), 'execute'))->join(","));
$sb->add(")");
break;
case "LIKE":
$sb->add($this->quoteField($wData[0]));
$sb->add(" LIKE ?");
$phValues->push(new _hx_array(array($wData[0], $wData[2])));
break;
default:
$sb->add($this->quoteField($wData[0]));
if (_hx_deref(new EReg("^(<|>)", ""))->match($wData[1])) {
$eR = new EReg("^(<|>)", "");
$eR->match($wData[1]);
$val = Std::parseFloat($eR->matchedRight());
$sb->add(_hx_string_or_null($eR->matched(0)) . "?");
$phValues->push(new _hx_array(array($wData[0], $val)));
continue 2;
}
if ($wData[1] === "NULL") {
$sb->add(" IS NULL");
} else {
$sb->add(" = ?");
$phValues->push(new _hx_array(array($wData[0], $wData[1])));
}
break;
}
unset($_g1);
unset($wData, $w, $values, $filter_tables);
}
$sob->add($sb->b);
return true;
}
示例5: decodeNumber
public function decodeNumber()
{
$sb = new StringBuf();
$hex = false;
$floating = false;
do {
$sb->add(com_wiris_util_json_JSon_0($this, $floating, $hex, $sb));
$this->nextToken();
if ($this->c === 120) {
$hex = true;
$sb->add(com_wiris_util_json_JSon_1($this, $floating, $hex, $sb));
$this->nextToken();
}
if ($this->c === 46 || $this->c === 69 || $this->c === 101) {
$floating = true;
}
} while ($this->c >= 48 && $this->c <= 58 || $hex && $this->isHexDigit($this->c) || $floating && ($this->c === 46 || $this->c === 69 || $this->c === 101 || $this->c === 45));
if ($floating) {
return Std::parseFloat($sb->b);
} else {
return Std::parseInt($sb->b);
}
}
示例6: unserialize
public function unserialize()
{
$_g = null;
$p = $this->pos++;
$_g = ord(substr($this->buf, $p, 1));
switch ($_g) {
case 110:
return null;
break;
case 116:
return true;
break;
case 102:
return false;
break;
case 122:
return 0;
break;
case 105:
return $this->readDigits();
break;
case 100:
$p1 = $this->pos;
while (true) {
$c = ord(substr($this->buf, $this->pos, 1));
if ($c >= 43 && $c < 58 || $c === 101 || $c === 69) {
$this->pos++;
} else {
break;
}
unset($c);
}
return Std::parseFloat(_hx_substr($this->buf, $p1, $this->pos - $p1));
break;
case 121:
$len = $this->readDigits();
if (haxe_Unserializer_3($this, $_g, $len) !== 58 || $this->length - $this->pos < $len) {
throw new HException("Invalid string length");
}
$s = _hx_substr($this->buf, $this->pos, $len);
$this->pos += $len;
$s = urldecode($s);
$this->scache->push($s);
return $s;
break;
case 107:
return Math::$NaN;
break;
case 109:
return Math::$NEGATIVE_INFINITY;
break;
case 112:
return Math::$POSITIVE_INFINITY;
break;
case 97:
$buf = $this->buf;
$a = new _hx_array(array());
$this->cache->push($a);
while (true) {
$c1 = ord(substr($this->buf, $this->pos, 1));
if ($c1 === 104) {
$this->pos++;
break;
}
if ($c1 === 117) {
$this->pos++;
$n = $this->readDigits();
$a[$a->length + $n - 1] = null;
unset($n);
} else {
$a->push($this->unserialize());
}
unset($c1);
}
return $a;
break;
case 111:
$o = _hx_anonymous(array());
$this->cache->push($o);
$this->unserializeObject($o);
return $o;
break;
case 114:
$n1 = $this->readDigits();
if ($n1 < 0 || $n1 >= $this->cache->length) {
throw new HException("Invalid reference");
}
return $this->cache[$n1];
break;
case 82:
$n2 = $this->readDigits();
if ($n2 < 0 || $n2 >= $this->scache->length) {
throw new HException("Invalid string reference");
}
return $this->scache[$n2];
break;
case 120:
throw new HException($this->unserialize());
break;
case 99:
//.........这里部分代码省略.........
示例7: parseRec
//.........这里部分代码省略.........
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;
}
$digit = true;
$zero = false;
break;
case 46:
if ($minus || $point) {
$this->invalidNumber($start);
}
$digit = false;
$point = true;
break;
case 101:
case 69:
if ($minus || $zero || $e) {
$this->invalidNumber($start);
}
$digit = false;
$e = true;
break;
case 43:
case 45:
if (!$e || $pm) {
$this->invalidNumber($start);
}
$digit = false;
$pm = true;
break;
default:
if (!$digit) {
$this->invalidNumber($start);
}
$this->pos--;
$end = true;
break;
}
if ($end) {
break;
}
}
$f = Std::parseFloat(_hx_substr($this->str, $start, $this->pos - $start));
$i = Std::int($f);
if (_hx_equal($i, $f)) {
return $i;
} else {
return $f;
}
break;
default:
$this->invalidChar();
break;
}
unset($c);
}
}
示例8: math2Img
public function math2Img($str, $prop)
{
$img = "<img";
$output = array();
$prop["centerbaseline"] = "false";
$prop["accessible"] = "true";
$prop["metrics"] = "true";
$src = null;
$alt = null;
$width = null;
$height = null;
$baseline = null;
if ($this->plugin->getConfiguration()->getProperty("wirispluginperformance", "false") === "false") {
$src = $this->render->createImage($str, $prop, $output);
$img .= " src=\"" . $src . "\"";
$alt = com_wiris_system_PropertiesTools::getProperty($output, "alt", null);
$width = com_wiris_system_PropertiesTools::getProperty($output, "width", null);
$height = com_wiris_system_PropertiesTools::getProperty($output, "height", null);
$baseline = com_wiris_system_PropertiesTools::getProperty($output, "baseline", null);
} else {
$digest = $this->render->computeDigest($str, $prop);
$json = com_wiris_util_json_JSon::decode($this->render->showImageJson($digest, com_wiris_system_PropertiesTools::getProperty($prop, "alt", null)));
$hashImage = $json;
if (_hx_equal($hashImage->get("status"), "warning")) {
$this->render->showImage(null, $str, $prop);
}
$json = com_wiris_util_json_JSon::decode($this->render->showImageJson($digest, "en"));
$hashImage = $json;
if (_hx_equal($hashImage->get("status"), "ok")) {
$result = $hashImage->get("result");
$base64 = $result->get("pngBase64");
$img .= " src=\"data:image/png;base64," . $base64 . "\"";
if ($result->exists("alt")) {
$alt = $result->get("alt");
} else {
$alt = $this->service->mathml2accessible($str, null, $prop);
}
$width = $result->get("width");
$height = $result->get("height");
$baseline = $result->get("baseline");
} else {
throw new HException("Image can't be rendererd");
}
}
$dpi = Std::parseFloat($this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$WIRIS_DPI, "96"));
if ($this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMS, null) !== null) {
$json = com_wiris_util_json_JSon::decode($this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMS, null));
$decodedHash = $json;
if ($decodedHash->exists("dpi")) {
$dpi = Std::parseFloat($decodedHash->get("dpi"));
}
}
$mml = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$FILTER_OUTPUT_MATHML, "false") === "true";
$f = 96 / $dpi;
$dwidth = $f * Std::parseFloat($width);
$dheight = $f * Std::parseFloat($height);
$dbaseline = $f * Std::parseFloat($baseline);
$alt = $this->html_entity_encode($alt);
$img .= " class=\"Wirisformula\"";
$img .= " alt=\"" . $alt . "\"";
$img .= " width=\"" . _hx_string_rec($dwidth, "") . "\"";
$img .= " height=\"" . _hx_string_rec($dheight, "") . "\"";
$d = $dbaseline - $dheight;
$img .= " style=\"vertical-align:" . _hx_string_rec($d, "") . "px\"";
if ($mml) {
$tag = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_MATHML_ATTRIBUTE, "data-mathml");
$img .= " " . $tag . "=\"" . $this->save_xml_encode($str) . "\"";
}
$img .= "/>";
return $img;
}
示例9: makeConst
public function makeConst($v)
{
haxe_Template::$expr_trim->match($v);
$v = haxe_Template::$expr_trim->matched(1);
if (_hx_char_code_at($v, 0) === 34) {
$str = _hx_substr($v, 1, strlen($v) - 2);
return array(new _hx_lambda(array(&$str, &$v), "haxe_Template_1"), 'execute');
}
if (haxe_Template::$expr_int->match($v)) {
$i = Std::parseInt($v);
return array(new _hx_lambda(array(&$i, &$v), "haxe_Template_2"), 'execute');
}
if (haxe_Template::$expr_float->match($v)) {
$f = Std::parseFloat($v);
return array(new _hx_lambda(array(&$f, &$v), "haxe_Template_3"), 'execute');
}
$me = $this;
return array(new _hx_lambda(array(&$me, &$v), "haxe_Template_4"), 'execute');
}
示例10: makeConst
public function makeConst($v)
{
haxe_Template::$expr_trim->match($v);
$v = haxe_Template::$expr_trim->matched(1);
if (_hx_char_code_at($v, 0) === 34) {
$str = _hx_substr($v, 1, strlen($v) - 2);
return array(new _hx_lambda(array("str" => &$str, "v" => &$v), null, array(), "{\n\t\t\t\treturn \$str;\n\t\t\t}"), 'execute0');
}
if (haxe_Template::$expr_int->match($v)) {
$i = Std::parseInt($v);
return array(new _hx_lambda(array("i" => &$i, "str" => &$str, "v" => &$v), null, array(), "{\n\t\t\t\treturn \$i;\n\t\t\t}"), 'execute0');
}
if (haxe_Template::$expr_float->match($v)) {
$f = Std::parseFloat($v);
return array(new _hx_lambda(array("f" => &$f, "i" => &$i, "str" => &$str, "v" => &$v), null, array(), "{\n\t\t\t\treturn \$f;\n\t\t\t}"), 'execute0');
}
$me = $this;
return array(new _hx_lambda(array("f" => &$f, "i" => &$i, "me" => &$me, "str" => &$str, "v" => &$v), null, array(), "{\n\t\t\treturn \$me->resolve(\$v);\n\t\t}"), 'execute0');
}