In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how php converts the value mandatory type to float, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
Method: 1, in front of the variable enclosed in parentheses with the target type "(float)", syntax "(float) $val"; 2, with floatval (), syntax "floatval ($val)"; 3, with settype (), syntax "settype ($val," float ")".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Php converts a value cast type to float
Method 1: add the target type "(float)" enclosed in parentheses before the variable to be converted
Method 2: use the floatval () function
Floatval (): used to get the floating-point value of a variable
Output result:
Method 3: use the settype () function
Syntax:
Settype ($var, $type)
The settype () function sets the variable $var to the specified $type type.
Example
Output result:
Description: the value that can be set for $type
"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)
The settype () function changes the type of the variable itself.
Thank you for reading this article carefully. I hope the article "how to convert the value mandatory type to float" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!
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.