In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces php how to convert float into a string, the article is very detailed, has a certain reference value, interested friends must read it!
Php converts float into a string: 1, add the target type "(string)" enclosed in parentheses before the float variable to be converted; 2, use the "strval ($float)" statement; 3, use the "settype ($float," string ")" statement.
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Method 1: add the target type enclosed in parentheses (string) before the float variable to be converted
Output result:
Method 2: use the strval () function
The strval () function can get the string value of a variable
Output result:
Method 3: use the settype () function
The settype ($var, $type) function is used to set or convert the type of variable, converting $var to $type.
The possible values for type are:
"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)
Example:
Output result:
Note: settype () modifies the type of the variable itself, returns true if the setting is successful, and false if it fails.
The above is all the content of the article "how php converts float to string". Thank you for reading! Hope to share the content to help you, more related knowledge, 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.