php method to convert a string to a floating point type: first save a string type decimal in the $str variable; then use float to force the string type to a floating point type; finally use gettype () function can obtain the converted variable type.
First save a string type decimal in the $str variable;
(Recommended tutorial:php graphic tutorial)
Then use float to force the string type to a floating point type, and save the result in the $res variable;
Finally use the gettype() function to obtain the converted Variable type, and use echo to output the result.
(Video tutorial recommendation:php video tutorial)
Code implementation:
Output results :
##
The above is the detailed content of How to convert string to floating point in php. For more information, please follow other related articles on the PHP Chinese website!