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--
Many novices are not very clear about how php converts strings into floating-point types. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
Php converts a string to a floating-point type: 1, add the target type "(float)", "(double)" or "(real)" enclosed in parentheses before the string variable, and the syntax "(float) $str"; 2, using the floatval () function, the syntax "floatval ($str)".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Data type conversion refers to the conversion of variables or values from one data type to another. There are two methods of conversion, which are automatic type conversion and cast type conversion.
Let's take a look at two ways to convert a string to a floating-point type.
Add the target type (float), (double), (real) enclosed in parentheses before the variable
Use the floatval () function
Example 1:
Output result:
Example 2:
Output result:
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.