Home  >  Article  >  Backend Development  >  Data type coercion method

Data type coercion method

一个新手
一个新手Original
2017-10-18 09:20:362624browse

1. PHP development involves the conversion of data types in many places, especially the data types involving amounts. They must be converted into float types, otherwise there may be errors due to different data types when entering the database. Overwrite the previous amount. (Adding string and float types)

2. Data type forced conversion: forced conversion to float type.

 'total_sum' =>(float)number_format($jmoney,2),
 'reward_sum'=>(float)number_format($jmoney,2),

The above is the detailed content of Data type coercion method. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn