當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CString::fromFloat方法代碼示例

本文整理匯總了PHP中CString::fromFloat方法的典型用法代碼示例。如果您正苦於以下問題:PHP CString::fromFloat方法的具體用法?PHP CString::fromFloat怎麽用?PHP CString::fromFloat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CString的用法示例。


在下文中一共展示了CString::fromFloat方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Creates an HTTP cookie to be sent along with an HTTP response.
  *
  * Internally, the value of a cookie is always stored as a string. If the cookie's value was provided as an array
  * or map, it's encoded into JSON and is stored as a JSON string. Boolean values are stored as "1" for `true` and
  * as "0" for `false`.
  *
  * @param  string $cookieName The cookie's name.
  * @param  mixed $value The cookie's value. This can be a string, a `bool`, an `int`, a `float`, an array, or a
  * map.
  */
 public function __construct($cookieName, $value)
 {
     assert('is_cstring($cookieName) && (is_cstring($value) || is_bool($value) || is_int($value) || ' . 'is_float($value) || is_collection($value))', vs(isset($this), get_defined_vars()));
     $this->m_name = $cookieName;
     if (is_cstring($value)) {
         $this->m_value = $value;
     } else {
         if (is_bool($value)) {
             $this->m_value = CString::fromBool10($value);
         } else {
             if (is_int($value)) {
                 $this->m_value = CString::fromInt($value);
             } else {
                 if (is_float($value)) {
                     $this->m_value = CString::fromFloat($value);
                 } else {
                     $json = new CJson($value);
                     $this->m_value = $json->encode();
                 }
             }
         }
     }
 }
開發者ID:nunodotferreira,項目名稱:Phred,代碼行數:34,代碼來源:CCookie.php

示例2: join

 /**
  * Joins the elements of an array into a string.
  *
  * The elements in the source array are not required to be all strings and, in addition to types that know how to
  * become a string, an element can be `int`, `float`, or `bool`. In the resulting string, a boolean value of
  * `true` becomes "1" and `false` becomes "0".
  *
  * As a special case, the array is allowed to be empty.
  *
  * @param  array $array The array containing the elements to be joined.
  * @param  string $binder The string to be put between any two elements in the resulting string, such as ", ".
  * Can be empty.
  *
  * @return string The resulting string.
  */
 public static function join($array, $binder)
 {
     assert('is_carray($array) && is_cstring($binder)', vs(isset($this), get_defined_vars()));
     $array = splarray($array);
     $array = self::makeCopy($array);
     for ($i = 0; $i < $array->getSize(); $i++) {
         if (!is_cstring($array[$i])) {
             if (is_bool($array[$i])) {
                 $array[$i] = CString::fromBool10($array[$i]);
             } else {
                 if (is_int($array[$i])) {
                     $array[$i] = CString::fromInt($array[$i]);
                 } else {
                     if (is_float($array[$i])) {
                         $array[$i] = CString::fromFloat($array[$i]);
                     }
                 }
             }
         }
     }
     return implode($binder, self::toPArray($array));
 }
開發者ID:nunodotferreira,項目名稱:Phred,代碼行數:37,代碼來源:CArray.php

示例3: setConfigOptionFloat

 /**
  * Sets the value of a PHP's configuration option to a floating-point value.
  *
  * @param  string $optionName The name of the option.
  * @param  float $optionValue The option's new value.
  *
  * @return void
  */
 public static function setConfigOptionFloat($optionName, $optionValue)
 {
     assert('is_cstring($optionName) && is_float($optionValue)', vs(isset($this), get_defined_vars()));
     self::setConfigOption($optionName, CString::fromFloat($optionValue));
 }
開發者ID:nunodotferreira,項目名稱:Phred,代碼行數:13,代碼來源:CSystem.php

示例4: recurseQueryValueBeforeComposingQs

 protected static function recurseQueryValueBeforeComposingQs($value, $currDepth)
 {
     if ($currDepth == self::$ms_maxRecursionDepth) {
         return $value;
     }
     $currDepth++;
     if (!is_collection($value)) {
         if (!is_cstring($value)) {
             if (is_bool($value)) {
                 $value = CString::fromBool10($value);
             } else {
                 if (is_int($value)) {
                     $value = CString::fromInt($value);
                 } else {
                     if (is_float($value)) {
                         $value = CString::fromFloat($value);
                     } else {
                         assert('false', vs(isset($this), get_defined_vars()));
                     }
                 }
             }
         }
         return $value;
     }
     if (is_carray($value)) {
         $value = splarray($value)->toArray();
     } else {
         $value = parray($value);
     }
     foreach ($value as &$mapValue) {
         $mapValue = self::recurseQueryValueBeforeComposingQs($mapValue, $currDepth);
     }
     unset($mapValue);
     return $value;
 }
開發者ID:nunodotferreira,項目名稱:Phred,代碼行數:35,代碼來源:CUrlQuery.php

示例5: collectionElementToString

 protected static function collectionElementToString($elementValue, &$success)
 {
     if (is_cstring($elementValue)) {
         return $elementValue;
     }
     if (is_bool($elementValue)) {
         return CString::fromBool10($elementValue);
     }
     if (is_int($elementValue)) {
         return CString::fromInt($elementValue);
     }
     if (is_float($elementValue)) {
         return CString::fromFloat($elementValue);
     }
     $success = false;
 }
開發者ID:nunodotferreira,項目名稱:Phred,代碼行數:16,代碼來源:CInputFilter.php


注:本文中的CString::fromFloat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。