Home  >  Article  >  Backend Development  >  Summary of methods for converting php strings to numbers

Summary of methods for converting php strings to numbers

藏色散人
藏色散人Original
2020-05-17 11:12:023355browse

Summary of methods for converting php strings to numbers

Summary of the method of converting php string to number

1. The first conversion method: add parentheses before the variable to be converted Enclosed target types, such as (int); (bool); (float); (string); (array); (object)

Summary of methods for converting php strings to numbers

2. The second type Conversion method: Use three specific types of conversion functions, intval(); floatval(); strval()

Summary of methods for converting php strings to numbers

3. The third conversion method: settype();

Summary of methods for converting php strings to numbers

Recommended: "PHP Tutorial"

The above is the detailed content of Summary of methods for converting php strings to numbers. 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