In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the php how to convert the value into floating-point related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that after reading this php how to convert the value into floating-point article will have a harvest, let's take a look.
Php value into floating-point method: 1, the use of floatval () function, you can get the variable floating-point value, syntax "floatval ($var)"; 2, the use of settype () function, you can set the variable to the specified type, syntax "settype ($var," float ")".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
The method of transforming values into floating point by php
1. Use the floatval () function
The floating-point conversion function floatval () gets the floating-point value of a variable.
Syntax:
Floatval ($var)
The parameter $var can be of any scalar type and returns the float value of the variable $var.
Note: floatval () cannot be used with arrays or objects.
Example:
2. Use the settype () function
The settype () function sets the variable to the specified type.
Syntax:
Settype ($var, $type)
Example:
The second parameter (the type of setting) can be:
"boolean" (or "bool", starting with PHP 4.2.0)
"integer" (or "int", starting with PHP 4.2.0)
"float" (available only after PHP 4.2.0, "double" used in older versions is now disabled)
"string"
"array"
"object"
"null" (since PHP 4.2.0)
Note: the settype () function changes the original type of the variable, returning TRUE if the setting is successful and FALSE if it fails.
This is the end of the article on "how php converts values to floating points". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how php converts values into floating points". If you want to learn more, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.